{"record":{"id":"a5896656b548c915","repo":"googleapis/mcp-toolbox","slug":"log-format-must-be-one-of-standard-or-json","errorCode":null,"errorMessage":"log format must be one of \"standard\", or \"json\"","messagePattern":"log format must be one of \"standard\", or \"json\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/server/config.go","lineNumber":127,"sourceCode":"\ntype logFormat string\n\n// String is used by both fmt.Print and by Cobra in help text\nfunc (f *logFormat) String() string {\n\tif string(*f) != \"\" {\n\t\treturn strings.ToLower(string(*f))\n\t}\n\treturn \"standard\"\n}\n\n// validate logging format flag\nfunc (f *logFormat) Set(v string) error {\n\tswitch strings.ToLower(v) {\n\tcase \"standard\", \"json\":\n\t\t*f = logFormat(v)\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(`log format must be one of \"standard\", or \"json\"`)\n\t}\n}\n\n// Type is used in Cobra help text\nfunc (f *logFormat) Type() string {\n\treturn \"logFormat\"\n}\n\ntype StringLevel string\n\n// String is used by both fmt.Print and by Cobra in help text\nfunc (s *StringLevel) String() string {\n\tif string(*s) != \"\" {\n\t\treturn strings.ToLower(string(*s))\n\t}\n\treturn \"info\"\n}\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/config.go#L109-L145","documentation":"This error comes from the logFormat flag type's Set method, used by Cobra/pflag when parsing the --log-format CLI flag. Only \"standard\" or \"json\" (case-insensitive) are accepted; anything else returns this validation error and the server fails to start.","triggerScenarios":"Starting the toolbox binary with --log-format set to an unsupported value such as \"text\", \"pretty\", \"\", or a typo like \"jsn\".","commonSituations":"Copying flags from other Go services that accept \"text\", CI scripts with wrong flag values, autocomplete mistakes.","solutions":["Use --log-format=standard or --log-format=json","Remove the flag entirely to use the default","Check --help for the accepted logFormat values"],"exampleFix":"// before\ntoolbox --log-format text\n// after\ntoolbox --log-format json","handlingStrategy":"validation","validationCode":"const ALLOWED = ['standard', 'json'];\nif (!ALLOWED.includes(logFormat.toLowerCase())) {\n  throw new Error(`log format must be one of ${ALLOWED}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass standard or json to --log-format","Read `toolbox --help` for accepted values","Pin flag values in deployment scripts/config"],"tags":["cli","flags","logging","validation"],"backgroundTag":"invalid-cli-flag-value","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}