{"record":{"id":"0d58a79a7b2d41b4","repo":"argoproj/argo-workflows","slug":"invalid-log-type-s","errorCode":null,"errorMessage":"invalid log type: %s","messagePattern":"invalid log type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/logging/logging.go","lineNumber":46,"sourceCode":"\tJSON LogType = \"json\"\n\tText LogType = \"text\"\n)\n\nfunc TypeFromStringOr(s string, defaultType LogType) (LogType, error) {\n\tif s == \"\" {\n\t\treturn defaultType, nil\n\t}\n\treturn TypeFromString(s)\n}\n\nfunc TypeFromString(s string) (LogType, error) {\n\tswitch strings.ToLower(s) {\n\tcase \"json\":\n\t\treturn JSON, nil\n\tcase \"text\":\n\t\treturn Text, nil\n\tdefault:\n\t\treturn Text, fmt.Errorf(\"invalid log type: %s\", s)\n\t}\n}\n\n// Level is used to indicate log level\ntype Level string\n\nconst (\n\t// Debug level events\n\tDebug Level = \"debug\"\n\t// Info level events\n\tInfo Level = \"info\"\n\t// Warn level events\n\tWarn Level = \"warn\"\n\t// Error level events\n\tError Level = \"error\"\n)\n\nfunc ParseLevelOr(s string, defaultLevel Level) (Level, error) {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/util/logging/logging.go#L28-L64","documentation":"TypeFromString converts a log-format string into the LogType enum; only \"json\" and \"text\" are accepted (case-insensitive). Anything else returns the default Text type plus this error so callers can report a misconfigured ARGO_LOG_FORMAT or equivalent setting.","triggerScenarios":"Setting the log format env var (e.g. ARGO_LOG_FORMAT) or calling TypeFromString/ContextWithLogger with values like \"pretty\", \"logfmt\", \"console\", or a trailing-space/newline-contaminated value.","commonSituations":"Deploy manifests or Helm values copying a log format from another tool (zap/logrus options); YAML env values that pick up quotes or whitespace; documentation drift after the logger migration to the repo's own util/logging.","solutions":["Set the format to exactly \"json\" or \"text\" (case-insensitive).","Prefer TypeFromStringOr/ContextWithLogger with an empty value so the default is applied instead of erroring.","Trim the value before passing: strings.TrimSpace(os.Getenv(...)).","If you need structured logs of a different shape, wrap the existing JSON logger rather than requesting a new type."],"exampleFix":"// before\nfmt, err := logging.TypeFromString(\"logfmt\")\n// after\nfmt, err := logging.TypeFromStringOr(strings.TrimSpace(cfg.Format), logging.Text)","handlingStrategy":"validation","validationCode":"var validLogTypes = map[string]bool{\"json\": true, \"text\": true}\nfunc logTypeValid(s string) bool { return s == \"\" || validLogTypes[strings.ToLower(strings.TrimSpace(s))] }","typeGuard":null,"tryCatchPattern":"lt, err := logging.TypeFromStringOr(strings.TrimSpace(raw), logging.Text)\nif err != nil {\n    log.Printf(\"bad log format %q, using text\", raw)\n    lt = logging.Text\n}","preventionTips":["Restrict config knobs to json/text and document them.","Trim env values before parsing.","Use the ...Or variants with a default instead of hard-failing on unset/odd values."],"tags":["go","logging","configuration"],"backgroundTag":"invalid-log-format","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}