{"record":{"id":"f9a35be4cccb7b5d","repo":"multica-ai/multica","slug":"source-agent-has-no-runtime-pass-runtime-id-to","errorCode":null,"errorMessage":"source agent has no runtime; pass --runtime-id to choose a target runtime","messagePattern":"source agent has no runtime; pass --runtime-id to choose a target runtime","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent_copy.go","lineNumber":123,"sourceCode":"\tvar src map[string]any\n\tif err := client.GetJSON(ctx, \"/api/agents/\"+args[0], &src); err != nil {\n\t\treturn fmt.Errorf(\"get source agent: %w\", err)\n\t}\n\n\tsrcRuntimeID := strVal(src, \"runtime_id\")\n\n\t// Resolve the target runtime: default to the source's runtime, override\n\t// with --runtime-id. A different value is a cross-runtime fork.\n\ttargetRuntimeID := srcRuntimeID\n\tif cmd.Flags().Changed(\"runtime-id\") {\n\t\tv, _ := cmd.Flags().GetString(\"runtime-id\")\n\t\tif v == \"\" {\n\t\t\treturn fmt.Errorf(\"--runtime-id must not be empty\")\n\t\t}\n\t\ttargetRuntimeID = v\n\t}\n\tif targetRuntimeID == \"\" {\n\t\treturn fmt.Errorf(\"source agent has no runtime; pass --runtime-id to choose a target runtime\")\n\t}\n\tsameRuntime := targetRuntimeID == srcRuntimeID\n\n\t// Name: default \"<source name> (copy)\", override with --name.\n\tname := strVal(src, \"name\") + \" (copy)\"\n\tif cmd.Flags().Changed(\"name\") {\n\t\tv, _ := cmd.Flags().GetString(\"name\")\n\t\tif v == \"\" {\n\t\t\treturn fmt.Errorf(\"--name must not be empty\")\n\t\t}\n\t\tname = v\n\t}\n\n\tbody := map[string]any{\n\t\t\"name\":       name,\n\t\t\"runtime_id\": targetRuntimeID,\n\t}\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent_copy.go#L105-L141","documentation":"Thrown by `multica agent copy` when the source agent's runtime_id is empty in the API response and no --runtime-id override was given. The copy needs a target runtime to build the POST body, and a source without one provides no default. This indicates old or partial data on the source agent rather than a flag typo.","triggerScenarios":"`multica agent copy <id>` where GET /api/agents/{id} returns runtime_id as \"\" or missing, and --runtime-id is not set on the command line.","commonSituations":"Agents created before runtimes existed or by an older API version; agents whose runtime was deleted; imported/migrated records with null runtime fields.","solutions":["Pass an explicit target: multica runtime list, then multica agent copy <id> --runtime-id <id>","Investigate why the source lacks a runtime (deleted runtime? legacy record?) and repair or re-create the source agent if it should have one"],"exampleFix":"# before\nmultica agent copy <id>   # source has empty runtime_id\n# after\nmultica agent copy <id> --runtime-id rt_abc123","handlingStrategy":"validation","validationCode":"# check the source has a runtime before copying\nRT=$(multica agent get \"$AGENT_ID\" --output json | jq -r '.runtime_id // empty')\nif [ -z \"$RT\" ]; then\n  multica agent copy \"$AGENT_ID\" --runtime-id \"$TARGET_RT\"\nelse\n  multica agent copy \"$AGENT_ID\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit legacy agents for missing runtime_id before scripting bulk copies","Keep --runtime-id handy in migration runbooks for exactly this case","Treat agents without a runtime as suspect data and repair them at the source"],"tags":["cli","api","data-integrity","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}