coze-dev / coze-dev/coze-studio
Workflow panic when object schema is map during canvas type conversion
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 21.6k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
Workflow test run may panic when object schema in canvas is encoded as map[string]interface{} instead of []interface{}.
Current panic:
Workflow execution failure: panic error: interface conversion: interface {} is map[string]interface {}, not []interface {}
.../backend/domain/workflow/internal/canvas/convert/type_convert.go:137
To Reproduce
Steps to reproduce the behavior:
- Create or open a workflow containing LLM/object-related inputs/outputs.
- Ensure one object schema is stored in map form (e.g.
{ "fieldA": {...}, "fieldB": {...} }) instead of array form. - Click test run (
/api/workflow_api/test_run). - Backend panics during canvas schema conversion.
Expected behavior
Workflow execution should not panic. Canvas conversion should accept both object-schema representations (array and map) and return normal validation errors when input is invalid.
Screenshots
N/A (stack trace included above).
Version:
- branch:
main(local reproduction) - reproducible on current code before fix
Environment:
go version go1.24.4 darwin/arm64GOOS=darwinGOARCH=arm64GOMOD=/Users/.../coze-studio/backend/go.mod
Additional context
Root cause is hard type assertion in type_convert.go assuming object schema is always []any. In practice, schema may come from map form after marshal/unmarshal or editor flow.
Proposed fix:
- normalize object schema to a common
[]anyrepresentation in conversion helpers - support wrapped object schema (
{"type":"object","schema":...}) - add tests for map-form schema and object-ref parsing
- avoid extra panic risk on filename metadata type assertion
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at backend/domain/workflow/internal/canvas/convert/type_convert.go:137 and reproduce the panic through /api/workflow_api/test_run with a map-form object schema. Trace the conversion helpers, then add coverage for map-form schemas, wrapped object schemas, object-ref parsing, and filename metadata; done means both array and map forms avoid panics and invalid input returns validation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100