Skip to content

Config schema validation errors show 'Unexpected server error' instead of field-level details #31954

Closed as not planned

Description

@iusamakhan

Issue: Config schema validation errors show "Unexpected server error" instead of which fields are wrong

What happens

When opencode.json has fields in the wrong format, the app shows:

"Failed to reload — Unexpected server error. Check server logs for details."

What should happen

It should show the exact field errors, e.g.:

["formatter"]["typescript"] — Expected object, got "prettier"
["permission"]["bash"]["allow"] — Expected pattern map, got array


Breaking schema changes in v1.16.x (no migration, no warning)

Field: skill

  • Old: {"skills": ["brainstorming"]}
  • New: Key removed — use skills: {paths:[], urls:[]}

Field: formatter

  • Old: {"typescript": "prettier"}
  • New: true or {"typescript": {"command": [...]}}

Field: permission

  • Old: {"bash": {"allow": ["npm *"]}}
  • New: {"bash": {"npm *": "allow"}}

Field: model

  • Old: {"provider": "deepseek", "model": "..."}
  • New: "deepseek/model-id" (string)

Root cause (code location)

File: packages/opencode/src/config/config.ts line 601

// This converts ConfigInvalidError (which has field details) into an untyped defect
return yield* loadInstanceState(ctx).pipe(Effect.orDie)

File: packages/opencode/src/server/routes/instance/httpapi/middleware/error.ts

// This check fails for the loadInstanceState code path
if (ConfigErrorV1.InvalidError.isInstance(error)) {
  return Effect.succeed(HttpServerResponse.jsonUnsafe(error.toObject(), { status: 400 }))
}
// Falls through to generic 500 👇

The field-level errors ARE computed and logged to ~/.local/share/opencode/log/ — they just never reach the user.

Suggested fix

Surface the ConfigInvalidError cause in the HTTP response instead of swallowing it into a generic 500.

Activity

  1. github-actions commented on Jun 11, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. github-actions commented on Aug 11, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions