coze-dev / coze-dev/coze-studio

Workflow panic when object schema is map during canvas type conversion

Open
#2,622 0 comments 0 reactions 0 assignees View on GitHub

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:

  1. Create or open a workflow containing LLM/object-related inputs/outputs.
  2. Ensure one object schema is stored in map form (e.g. { "fieldA": {...}, "fieldB": {...} }) instead of array form.
  3. Click test run (/api/workflow_api/test_run).
  4. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.