{"record":{"id":"53105dcba812f9b2","repo":"crowdsecurity/crowdsec","slug":"invalid-auth-type-must-be-one-of-basic-auth-head","errorCode":null,"errorMessage":"invalid auth_type: must be one of basic_auth, headers, mtls","messagePattern":"invalid auth_type: must be one of basic_auth, headers, mtls","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/http/config.go","lineNumber":126,"sourceCode":"\t\t}\n\n\t\tif c.BasicAuth.Username == \"\" {\n\t\t\treturn errors.New(baseErr + \" username is not provided\")\n\t\t}\n\n\t\tif c.BasicAuth.Password == \"\" {\n\t\t\treturn errors.New(baseErr + \" password is not provided\")\n\t\t}\n\tcase \"headers\":\n\t\tif c.Headers == nil {\n\t\t\treturn errors.New(\"headers is selected, but headers is not provided\")\n\t\t}\n\tcase \"mtls\":\n\t\tif c.TLS == nil || c.TLS.CaCert == \"\" {\n\t\t\treturn errors.New(\"mtls is selected, but ca_cert is not provided\")\n\t\t}\n\tdefault:\n\t\treturn errors.New(\"invalid auth_type: must be one of basic_auth, headers, mtls\")\n\t}\n\n\tif c.TLS != nil {\n\t\tif c.TLS.ServerCert == \"\" {\n\t\t\treturn errors.New(\"server_cert is required\")\n\t\t}\n\n\t\tif c.TLS.ServerKey == \"\" {\n\t\t\treturn errors.New(\"server_key is required\")\n\t\t}\n\t}\n\n\tif c.MaxBodySize != nil && *c.MaxBodySize <= 0 {\n\t\treturn errors.New(\"max_body_size must be positive\")\n\t}\n\n\t/*\n\t\tif hc.ChunkSize != nil && *hc.ChunkSize <= 0 {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/http/config.go#L108-L144","documentation":"The http acquisition source's auth_type is set to a value other than the three supported ones: basic_auth, headers, or mtls. Validate() uses a switch over AuthType and its default branch rejects anything unrecognized. This catches typos, wrong casing, and auth schemes the source does not implement.","triggerScenarios":"YAML config sets auth_type to something like \"mTLS\", \"mtls \", \"token\", \"none\", \"client_cert\", or is misspelled (\"basicauth\"). Also fires when auth_type is an unexpected type coerced oddly. Raised by Configuration.Validate() (config.go:125-126) during acquisition file load.","commonSituations":"Typo or wrong casing (\"mTLS\" instead of \"mtls\"), copying config from another product that supports other auth schemes (api_key, bearer, none), forgetting to set auth_type entirely so it stays empty and hits the default branch.","solutions":["Set auth_type to exactly one of: basic_auth, headers, mtls (lowercase, no whitespace)","If using basic_auth, add the basic_auth block with username/password; if headers, add a headers map; if mtls, add tls with server_cert/server_key/ca_cert","Remove surrounding quotes/spaces or fix casing in the YAML value","Check the documentation for the http source to confirm supported auth_type values in your CrowdSec version"],"exampleFix":"# before\nsource: http\nlisten_addr: 127.0.0.1:8080\nauth_type: mTLS\n# after\nsource: http\nlisten_addr: 127.0.0.1:8080\nauth_type: mtls\ntls:\n  server_cert: /etc/ssl/server.crt\n  server_key: /etc/ssl/server.key","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"basic_auth\": true, \"headers\": true, \"mtls\": true}\nif !valid[cfg.AuthType] {\n    return fmt.Errorf(\"auth_type %q not supported; use basic_auth, headers or mtls\", cfg.AuthType)\n}","typeGuard":"func authTypeSupported(t string) bool {\n    switch t {\n    case \"basic_auth\", \"headers\", \"mtls\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"if _, err := httpacquisition.ConfigurationFromYAML(y); err != nil {\n    if strings.Contains(err.Error(), \"invalid auth_type\") {\n        return fmt.Errorf(\"acquisition file rejected, fix auth_type: %w\", err)\n    }\n    return err\n}","preventionTips":["Use the exact lowercase literal auth_type values: basic_auth, headers, mtls","Copy auth_type from official CrowdSec http source documentation, not other products","Lint acquisition YAML with strict parsing before deployment to catch typos early"],"tags":["crowdsec","http-acquisition","config-validation","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}