{"record":{"id":"bb25758068575f1e","repo":"multica-ai/multica","slug":"s-empty-input-pass-null-to-clear-or-a-json-ob","errorCode":null,"errorMessage":"%s: empty input; pass 'null' to clear or a JSON object to set","messagePattern":"(.+?): empty input; pass 'null' to clear or a JSON object to set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":1327,"sourceCode":"// the secret-safe flag channels. A top-level array or primitive is rejected\n// because it can never be a valid MCP payload — this mirrors the agent-settings\n// UI (mcp-config-tab.tsx). Empty/whitespace input is rejected rather than\n// treated as a clear: for the stdin/file channels it almost always signals an\n// upstream failure (missing file, unset pipe) rather than a deliberate clear,\n// and silently wiping a secret-bearing field is the wrong default.\n//\n// allowNull controls whether the literal `null` is accepted as the clear\n// sentinel. It is not for a single server entry, where removing something has\n// its own command and `null` is far more likely to be a mistake.\n//\n// The payload is treated as secret material (MCP entries routinely carry API\n// tokens), so parse errors never wrap the underlying json error, which can\n// echo short fragments of malformed input.\nfunc parseMcpJSONObject(flag, raw string, allowNull bool) (json.RawMessage, error) {\n\ttrimmed := strings.TrimSpace(raw)\n\tif trimmed == \"\" {\n\t\tif allowNull {\n\t\t\treturn nil, fmt.Errorf(\"%s: empty input; pass 'null' to clear or a JSON object to set\", flag)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"%s: empty input; pass a JSON object\", flag)\n\t}\n\tvar probe any\n\tif err := json.Unmarshal([]byte(trimmed), &probe); err != nil {\n\t\tif allowNull {\n\t\t\treturn nil, fmt.Errorf(\"%s must be a valid JSON object, or 'null' to clear\", flag)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"%s must be a valid JSON object\", flag)\n\t}\n\tif probe == nil {\n\t\tif allowNull {\n\t\t\t// null → clear (NULL column server-side; on create it is a no-op).\n\t\t\treturn json.RawMessage(\"null\"), nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"%s must be a JSON object, not null\", flag)\n\t}\n\tif _, ok := probe.(map[string]any); !ok {","sourceCodeStart":1309,"sourceCodeEnd":1345,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L1309-L1345","documentation":"Error \"%s: empty input; pass 'null' to clear or a JSON object to set\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/cmd/multica/cmd_agent.go:1327 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide non-empty input: a JSON object to set or 'null' to clear."],"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"}