{"record":{"id":"2ddb576fe076b882","repo":"multica-ai/multica","slug":"runtime-id-must-not-be-empty","errorCode":null,"errorMessage":"--runtime-id must not be empty","messagePattern":"--runtime-id must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent_copy.go","lineNumber":118,"sourceCode":"\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\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","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent_copy.go#L100-L136","documentation":"Thrown by `multica agent copy` when --runtime-id was explicitly set on the command line but its value is the empty string. The CLI checks Changed(\"runtime-id\") first, so the flag counts as supplied even when empty, and the empty value is then rejected before any POST. Typically a shell variable expanding to nothing.","triggerScenarios":"`multica agent copy <id> --runtime-id \"$RUNTIME\"` with RUNTIME unset/empty; scripts passing --runtime-id= with an empty default; whitespace-only is not saved either since only == \"\" is checked after GetString.","commonSituations":"Optional runtime selection in a wrapper script where the variable was never populated; copy-paste of a command template with a placeholder left empty.","solutions":["Supply a real runtime ID: multica runtime list, then --runtime-id <id>","Or omit --runtime-id entirely to copy within the source agent's runtime","In scripts, conditionally include the flag only when the variable is non-empty"],"exampleFix":"# before\nmultica agent copy <id> --runtime-id \"$RT\"   # RT=\"\"\n# after\nmultica agent copy <id>                      # same-runtime copy\n# or\nmultica agent copy <id> --runtime-id rt_abc123","handlingStrategy":"validation","validationCode":"if [ -n \"${RUNTIME_ID:-}\" ]; then\n  multica agent copy \"$AGENT_ID\" --runtime-id \"$RUNTIME_ID\"\nelse\n  multica agent copy \"$AGENT_ID\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only append --runtime-id when the variable is non-empty","Treat explicitly-empty overrides as errors in wrapper scripts, matching the CLI","Use set -u to catch unset variables early"],"tags":["cli","flags","validation","shell","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}