{"record":{"id":"3365438af3265466","repo":"multica-ai/multica","slug":"specify-the-new-env-via-custom-env-custom-env","errorCode":null,"errorMessage":"specify the new env via --custom-env, --custom-env-stdin, or --custom-env-file (pass '{}' to clear)","messagePattern":"specify the new env via --custom-env, --custom-env-stdin, or --custom-env-file \\(pass '(.+?)' to clear\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":1168,"sourceCode":"\n// runAgentEnvSet replaces an agent's custom_env wholesale via the\n// audited `/env` endpoint. The three secret-safe input channels\n// (--custom-env, --custom-env-stdin, --custom-env-file) are required\n// — at least one must be supplied — and the server treats any value\n// equal to \"****\" as \"preserve the existing entry\" (see the **** guard\n// in the handler).\nfunc runAgentEnvSet(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tce, ok, err := resolveCustomEnv(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !ok {\n\t\treturn fmt.Errorf(\"specify the new env via --custom-env, --custom-env-stdin, or --custom-env-file (pass '{}' to clear)\")\n\t}\n\n\tbody := map[string]any{\"custom_env\": ce}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar result map[string]any\n\tif err := client.PutJSON(ctx, \"/api/agents/\"+args[0]+\"/env\", body, &result); err != nil {\n\t\treturn fmt.Errorf(\"update agent env: %w\", err)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {\n\t\treturn cli.PrintJSON(os.Stdout, result)\n\t}\n\n\tenv, _ := result[\"custom_env\"].(map[string]any)","sourceCodeStart":1150,"sourceCodeEnd":1186,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L1150-L1186","documentation":"Error \"specify the new env via --custom-env, --custom-env-stdin, or --custom-env-file (pass '{}' to clear)\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/cmd/multica/cmd_agent.go:1168 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the new env via --custom-env, --custom-env-stdin, or --custom-env-file ('{}' clears it)."],"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-15T22:17:37.221Z"}