Skip to content

bug(cli): sandbox create with duplicate name returns raw database error instead of user-friendly message #691

@areporeporepo

Description

@areporeporepo

agent diagnostic

  • loaded openshell-cli skill — checked sandbox create --help for --force/--replace/--overwrite flags; none exist
  • loaded debug-openshell-cluster skill — cluster is healthy (openshell status and openshell doctor check both pass)
  • confirmed workaround: sandbox delete <name> then sandbox create --name <name> works, but the error message gives no hint to do this
  • agent cannot resolve: the error originates in the grpc server layer — sqlite unique constraint error (code 2067) is surfaced as a raw internal grpc status instead of being caught and mapped to alreadyexists with a human-readable message. this requires a server-side code change in the persist layer or grpc handler.

description

actual behavior: creating a sandbox with a name that already exists returns a raw internal error exposing sqlite internals and grpc metadata:

error: × status: Internal, message: "persist sandbox failed: execution error:
  database error: error returned from database: (code: 2067) UNIQUE
  constraint failed: objects.object_type, objects.name", details: [],
  metadata: MetadataMap { headers: {"content-type": "application/grpc",
  "date": "Mon, 30 Mar 2026 23:51:20 GMT"} }

expected behavior: a clear, actionable error like:

error: sandbox 'dupe-test' already exists

hint: delete it first with: openshell sandbox delete dupe-test
      or use a different name

reproduction steps

  1. openshell sandbox create --name dupe-test --no-tty -- sleep 120 &
  2. wait for sandbox to reach ready phase (openshell sandbox list)
  3. openshell sandbox create --name dupe-test --no-tty -- echo "second"
  4. observe raw database error instead of "already exists" message

environment

  • os: macos 26.3.1 (darwin, apple silicon)
  • docker: docker desktop 29.2.1
  • openshell: v0.0.6

logs

$ openshell sandbox create --name dupe-test --no-tty -- echo "second"
Error:   × status: Internal, message: "persist sandbox failed: execution error:
  │ database error: error returned from database: (code: 2067) UNIQUE
  │ constraint failed: objects.object_type, objects.name", details: [],
  │ metadata: MetadataMap { headers: {"content-type": "application/grpc",
  │ "date": "Mon, 30 Mar 2026 23:51:20 GMT"} }

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