Skip to content

bug: fixing the endpoint msg string causing model in pending state#670

Open
Vishvajeet590 wants to merge 5 commits into
mainfrom
fix-version-endpoint-msg
Open

bug: fixing the endpoint msg string causing model in pending state#670
Vishvajeet590 wants to merge 5 commits into
mainfrom
fix-version-endpoint-msg

Conversation

@Vishvajeet590

@Vishvajeet590 Vishvajeet590 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What

Fix Postgres invalid byte sequence for encoding "UTF8" (SQLSTATE 22021) error when saving a version endpoint's deployment message.

Why

When a deployment fails, the Kubernetes error text (which often contains multi-byte box-drawing chars like = 0xe2 0x94 0x80) is stored in version_endpoints.message. sanitizeEndpoint truncated it to maxMessageChar by byte slicing, which could cut a multi-byte character in half, leaving an invalid trailing sequence (e.g. 0xe2 0x94). Postgres then rejected the write, so the endpoint status/message never updated:

Error example

merlin {"level":"error","ts":1783331067.766427,"caller":"work/model_service_deployment.go:164","msg":"unable to update endpoint status for model: external-demo, version: 16, reason: ERROR: invalid byte sequence for encoding \"UTF8\": 0xe2 0x94 (SQLSTATE 22021)","stacktrace":"github.com/caraml-dev/merlin/queue/work.(*ModelServiceDeployment).Deploy.func1\n\t/src/api/queue/work/model_service_deployment.go:164\ngithub.com/caraml-dev/merlin/queue/work.(*ModelServiceDeployment).Deploy\n\t/src/api/queue/work/model_service_deployment.go:189\ngithub.com/caraml-dev/merlin/queue.(*worker).processJob\n\t/src/api/queue/worker.go:81"}

@Vishvajeet590 Vishvajeet590 changed the title fix: fixing the endpoint msg string bug: fixing the endpoint msg string causing model in pending state Jul 8, 2026
@anantadwi13 anantadwi13 added the bug Something isn't working label Jul 8, 2026

@anantadwi13 anantadwi13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. looks like the unit tests are already on the main branch 👀
b0ffd2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants