{"record":{"id":"ddd6bfac8db66881","repo":"crowdsecurity/crowdsec","slug":"parsing-console-config-file-s-w","errorCode":null,"errorMessage":"parsing console config file '%s': %w","messagePattern":"parsing console config file '(.+?)': %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/csconfig/console.go","lineNumber":85,"sourceCode":"\tif _, err := os.Stat(c.ConsoleConfigPath); err != nil && os.IsNotExist(err) {\n\t\tlog.Debugf(\"no console configuration to load\")\n\n\t\tc.ConsoleConfig.ShareCustomScenarios = new(true)\n\t\tc.ConsoleConfig.ShareTaintedScenarios = new(true)\n\t\tc.ConsoleConfig.ShareManualDecisions = new(false)\n\t\tc.ConsoleConfig.ShareContext = new(false)\n\n\t\treturn nil\n\t}\n\n\tyamlFile, err := os.ReadFile(c.ConsoleConfigPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reading console config file '%s': %w\", c.ConsoleConfigPath, err)\n\t}\n\n\terr = yaml.Unmarshal(yamlFile, c.ConsoleConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parsing console config file '%s': %w\", c.ConsoleConfigPath, err)\n\t}\n\n\tif c.ConsoleConfig.ShareCustomScenarios == nil {\n\t\tlog.Debugf(\"no share_custom scenarios found, setting to true\")\n\t\tc.ConsoleConfig.ShareCustomScenarios = new(true)\n\t}\n\n\tif c.ConsoleConfig.ShareTaintedScenarios == nil {\n\t\tlog.Debugf(\"no share_tainted scenarios found, setting to true\")\n\t\tc.ConsoleConfig.ShareTaintedScenarios = new(true)\n\t}\n\n\tif c.ConsoleConfig.ShareManualDecisions == nil {\n\t\tlog.Debugf(\"no share_manual scenarios found, setting to false\")\n\t\tc.ConsoleConfig.ShareManualDecisions = new(false)\n\t}\n\n\tif c.ConsoleConfig.ShareContext == nil {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/csconfig/console.go#L67-L103","documentation":"The console configuration file (console.yaml) could not be unmarshalled from YAML into the console config struct. The file was read successfully; its content is malformed YAML or has a structure that does not match the expected schema.","triggerScenarios":"console.yaml exists and is readable but contains invalid YAML (tabs, bad indentation) or wrong types like `share_custom_scenarios: \"yes please\"` instead of a boolean.","commonSituations":"Hand-editing console.yaml to toggle sharing options and breaking indentation; using tab characters; writing `true/false` with quotes or extra text; YAML anchors misused.","solutions":["Validate the file with a YAML linter (`yamllint /etc/crowdsec/console.yaml`)","Fix values to booleans: share_custom_scenarios, share_tainted_scenarios, share_manual_decisions, share_context","Replace tabs with spaces","Restore the default file shipped with the package"],"exampleFix":"// before (console.yaml)\nshare_custom_scenarios:\n\t- true\n// after\nshare_custom_scenarios: true","handlingStrategy":"validation","validationCode":"var probe ConsoleConfig\nif err := yaml.Unmarshal(rawConsoleYAML, &probe); err != nil {\n\treturn fmt.Errorf(\"console.yaml invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := serverCfg.LoadConsoleConfig(); err != nil {\n\tif strings.Contains(err.Error(), \"parsing console config file\") {\n\t\tlog.Fatalf(\"fix %s YAML: %v\", serverCfg.ConsoleConfigPath, err)\n\t}\n\treturn err\n}","preventionTips":["Only boolean values for the four share_* keys","Lint with yamllint before deploying","Configure via `cscli console` commands instead of hand-editing where possible"],"tags":["yaml","console","parsing","config"],"backgroundTag":"yaml-parse-error","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}