{"record":{"id":"490ff19ffaac6ec1","repo":"multica-ai/multica","slug":"custom-env-empty-input-pass-to-clear","errorCode":null,"errorMessage":"--custom-env: empty input; pass '{}' to clear","messagePattern":"--custom-env: empty input; pass '(.+?)' to clear","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":1207,"sourceCode":"}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n// parseCustomEnv parses the --custom-env flag value (a JSON object literal)\n// into a string map suitable for the request body. The clear-all signal is\n// the explicit JSON object \"{}\"; empty or whitespace-only input is rejected\n// because for the stdin/file channels it almost always means an upstream\n// failure (missing file, unset pipe, set -o pipefail off) rather than a\n// deliberate clear. Treating it as \"clear\" silently wipes secrets.\n//\n// The payload is treated as secret material: parse errors never wrap the\n// underlying json error, because json.SyntaxError / UnmarshalTypeError can\n// surface short fragments of the input on some malformed inputs.\nfunc parseCustomEnv(raw string) (map[string]string, error) {\n\tif strings.TrimSpace(raw) == \"\" {\n\t\treturn nil, fmt.Errorf(\"--custom-env: empty input; pass '{}' to clear\")\n\t}\n\tvar ce map[string]string\n\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) {","sourceCodeStart":1189,"sourceCodeEnd":1225,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L1189-L1225","documentation":"Error \"--custom-env: empty input; pass '{}' to clear\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/cmd/multica/cmd_agent.go:1207 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass '{}' to clear the env or provide a non-empty JSON object."],"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"}