{"record":{"id":"659eabf19be9bd46","repo":"multica-ai/multica","slug":"custom-args-must-be-a-valid-json-array-of-string","errorCode":null,"errorMessage":"--custom-args must be a valid JSON array of strings","messagePattern":"--custom-args must be a valid JSON array of strings","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":1228,"sourceCode":"\tif err := json.Unmarshal([]byte(raw), &ce); err != nil {\n\t\treturn nil, fmt.Errorf(\"--custom-env must be a valid JSON object of string keys and string values\")\n\t}\n\tif ce == nil {\n\t\tce = map[string]string{}\n\t}\n\treturn ce, nil\n}\n\n// parseCustomArgs parses the --custom-args flag value (a JSON array of\n// CLI argument strings). The error message is content-free for the same\n// reason as parseCustomEnv: although custom_args is not a dedicated\n// secret channel today, it routinely carries values like \"--api-key=…\"\n// for runtime providers, and json.Unmarshal errors can echo short\n// fragments of malformed input.\nfunc parseCustomArgs(raw string) ([]string, error) {\n\tvar ca []string\n\tif err := json.Unmarshal([]byte(raw), &ca); err != nil {\n\t\treturn nil, fmt.Errorf(\"--custom-args must be a valid JSON array of strings\")\n\t}\n\treturn ca, nil\n}\n\n// resolveCustomEnv collects the --custom-env, --custom-env-stdin, and\n// --custom-env-file flags and returns the parsed map, a bool indicating\n// whether the caller supplied any of them, and any error. The three input\n// channels are mutually exclusive so callers can't accidentally provide a\n// secret twice. Stdin and file inputs exist to keep secret material out of\n// shell history and 'ps' / /proc/<pid>/cmdline.\nfunc resolveCustomEnv(cmd *cobra.Command) (map[string]string, bool, error) {\n\tinline := cmd.Flags().Changed(\"custom-env\")\n\tfromStdin, _ := cmd.Flags().GetBool(\"custom-env-stdin\")\n\tfilePath, _ := cmd.Flags().GetString(\"custom-env-file\")\n\t// Note: an explicit --custom-env-file \"\" is honored as \"the user asked\n\t// for this channel with an empty path\" and surfaces a real error below,\n\t// rather than being silently swallowed.\n\tfromFile := cmd.Flags().Changed(\"custom-env-file\")","sourceCodeStart":1210,"sourceCodeEnd":1246,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L1210-L1246","documentation":"Error \"--custom-args must be a valid JSON array of strings\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/cmd/multica/cmd_agent.go:1228 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a valid JSON array of strings for --custom-args."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}