Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix "failed to get embeddings for error group tag" error when error_object_id is 0#10287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/fix-embedding-error

Conversation

Copy link

CopilotAI commentedOct 22, 2025
edited
Loading

Problem

The backend was logging repeated errors with the message "failed to get embeddings for error group tag" with attributes showing"error": "INVALID" and"error_object_id": "0". These errors were occurring 34+ times per minute, creating significant log noise.

Root Cause

ThetagErrorGroup function in/backend/public-graph/graph/resolver.go was being called before error objects were persisted to the database. This happened at two locations withinGetOrCreateErrorGroup:

  • Line 456: When creating a new error group
  • Line 488: When updating an existing error group

At both call sites, the error object hasn't been saved yet, soerrorObj.ID is 0. The embeddings service expects a valid error object ID and returns "INVALID" when it receives 0.

Solution

Added a guard clause at the beginning oftagErrorGroup to skip processing when the error object ID is 0:

func (r*Resolver)tagErrorGroup(ctx context.Context,errorObj*model.ErrorObject)*int {iferrorObj.ID==0 {returnnil    }// ... rest of function}

This is a minimal, surgical fix that:

  • ✅ Eliminates the log noise from "INVALID" errors
  • ✅ Prevents unnecessary embeddings API calls with invalid data
  • ✅ Maintains existing behavior (the function already handles failures by returningnil)
  • ✅ Has no impact on functionality since error tagging is optional and errors are still properly grouped

Testing

Added two test cases to verify the fix:

  • TestTagErrorGroup_WithZeroID: Confirms the function returns nil when ID is 0
  • TestTagErrorGroup_WithValidID: Confirms normal processing continues with valid IDs

Both tests follow existing patterns in the codebase and compile successfully.

Impact

This fix addresses the issue raised in the logs without requiring any changes to the error grouping flow or embeddings infrastructure. Error objects will still be tagged appropriately once they have valid IDs, but we no longer attempt to tag them prematurely.

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix "failed to get embeddings for error group tag" error when error_object_id is 0</issue_title>
<issue_description>## Problem

The backend is logging repeated errors with the message "failed to get embeddings for error group tag" with attributes showing"error": "INVALID" and"error_object_id": "0".

From the logs and traces, this error occurs during theresolver.GetTopErrorGroupMatchByEmbedding span, which is called from within thetagErrorGroup function.

Root Cause

The issue is in/backend/public-graph/graph/resolver.go in thetagErrorGroup function (lines 401-413):

func (r*Resolver)tagErrorGroup(ctx context.Context,errorObj*model.ErrorObject)*int {eMatchCtx,cancel:=context.WithTimeout(ctx,embeddings.InferenceTimeout)defercancel()query:=embeddings.GetErrorObjectQuery(errorObj)tags,err:=embeddings.MatchErrorTag(eMatchCtx,r.DB,r.EmbeddingsClient,query)iferr==nil&&len(tags)>0 {return&tags[0].ID    }else {log.WithContext(ctx).WithError(err).WithField("error_object_id",errorObj.ID).Error("failed to get embeddings for error group tag")    }returnnil}

This function is called fromGetOrCreateErrorGroup at two locations:

  • Line 456: When creating a new error group (before the error object is saved)
  • Line 488: When updating an existing error group (also before the error object is saved)

The problem is thaterrorObj.ID is0 because the error object hasn't been persisted to the database yet whentagErrorGroup is called. The embeddings service expects a valid error object ID and returns "INVALID" when it receives 0.

Proposed Solution

There are two potential approaches:

Option 1: Skip tagging when error object ID is 0

Add a guard clause at the beginning oftagErrorGroup:

func (r*Resolver)tagErrorGroup(ctx context.Context,errorObj*model.ErrorObject)*int {iferrorObj.ID==0 {returnnil    }eMatchCtx,cancel:=context.WithTimeout(ctx,embeddings.InferenceTimeout)defercancel()// ... rest of function}

Option 2: Use error object content instead of ID

Modify the embeddings code to not require a saved error object ID, using the error content directly for matching.

Recommendation

Option 1 is simpler and safer. The error tagging can be deferred until the error object has been persisted to the database, or it could be handled in a separate process after error objects are created.

Impact

  • Reduces log noise from repeated "INVALID" errors
  • Prevents unnecessary embeddings API calls with invalid data
  • Should not affect functionality since the function already handles the case where tagging fails by returningnil

Traces

The error pattern shows:

  • Multiple occurrences per minute (34+ instances in logs)
  • Always witherror_object_id: "0" anderror: "INVALID"
  • Traces show the error occurs in spanresolver.GetTopErrorGroupMatchByEmbedding
  • Theopenai.GetEmbeddings span showsnum_errors: "1" indicating the embeddings call is actually being made but failing</issue_description>

Comments on the Issue (you are@copilot in this section)

Fixes#10285


💬 We'd love your input! Share your thoughts on Copilot coding agent in our2 minute survey.

@changeset-bot
Copy link

changeset-botbot commentedOct 22, 2025
edited
Loading

⚠️ No Changeset found

Latest commit:1edc67d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go.If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

CopilotAIand others added3 commitsOctober 22, 2025 02:27
Co-authored-by: mayberryzane <86132398+mayberryzane@users.noreply.github.com>
Co-authored-by: mayberryzane <86132398+mayberryzane@users.noreply.github.com>
Co-authored-by: mayberryzane <86132398+mayberryzane@users.noreply.github.com>
CopilotAI changed the title[WIP] Fix 'failed to get embeddings for error group tag' errorFix "failed to get embeddings for error group tag" error when error_object_id is 0Oct 22, 2025
Copilot finished work on behalf ofmayberryzaneOctober 22, 2025 02:38
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@mayberryzanemayberryzaneAwaiting requested review from mayberryzane

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Fix "failed to get embeddings for error group tag" error when error_object_id is 0

2 participants

@mayberryzane

[8]ページ先頭

©2009-2025 Movatter.jp