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/arm64
GOOS=darwin
GOARCH=arm64
GOMOD=/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
[]any representation 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