{"record":{"id":"06fecc6726d61fc7","repo":"t8y2/dbx","slug":"load-kerberos-config-s-w","errorCode":null,"errorMessage":"load Kerberos config %s: %w","messagePattern":"load Kerberos config (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/kerberos.go","lineNumber":115,"sourceCode":"\t\tif err := config.applyJAASConfig(path); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tconfig.applyKerberosConfigEnvironment()\n\tif config.configPath == \"\" {\n\t\tconfig.configPath = defaultKerberosConfigPath()\n\t}\n\tpath, err := normalizeLocalFilePath(firstPathListEntry(config.configPath))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid Kerberos config path: %w\", err)\n\t}\n\tconfig.configPath = path\n\tif err := requireRegularFile(\"Kerberos config\", config.configPath); err != nil {\n\t\treturn err\n\t}\n\tkrbConfig, err := krb5config.Load(config.configPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"load Kerberos config %s: %w\", config.configPath, err)\n\t}\n\tif config.serviceName == \"\" {\n\t\tconfig.serviceName = \"cassandra\"\n\t}\n\tif !kerberosQOPIncludesAuth(config.qop) {\n\t\treturn fmt.Errorf(\"Cassandra Kerberos currently supports SASL QOP auth only, got %s\", config.qop)\n\t}\n\tconfig.qop = \"auth\"\n\tif config.principal == \"\" {\n\t\tconfig.principal = strings.TrimSpace(username)\n\t}\n\tif config.password == \"\" {\n\t\tconfig.password = password\n\t}\n\tif config.useTicketCache {\n\t\treturn config.selectCCacheCredential()\n\t}\n\tif config.useKeytab {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/kerberos.go#L97-L133","documentation":"finalize throws this when krb5config.Load fails to parse the krb5.conf file at config.configPath. The file exists and is a regular file (requireRegularFile already passed) but its contents are invalid — bad sections, malformed relations, or unsupported syntax — so the driver cannot build Kerberos realm/KDC mappings.","triggerScenarios":"finalize loading a syntactically invalid krb5.conf (e.g. missing [libdefaults] section braces, stray characters, unknown encoding) during newKerberosAuthProvider or in tests exercising finalize.","commonSituations":"Hand-edited krb5.conf with a syntax error, a Windows-edited file with BOM or CRLF issues, or a truncated file produced by a config management tool.","solutions":["Validate the krb5.conf named in the error (e.g. with `krb5-config` or `kinit -t`-style tools / k5test) and fix the syntax error it reports.","Restore a known-good krb5.conf from your Kerberos admin or package defaults.","Check for BOM/CRLF corruption if the file was edited on Windows and re-save as UTF-8 without BOM with LF line endings."],"exampleFix":"// before (malformed)\n[libdefaults\n default_realm = EXAMPLE.COM\n\n// after\n[libdefaults]\n default_realm = EXAMPLE.COM","handlingStrategy":"validation","validationCode":"func validateKrb5Syntax(path string) error {\n    data, err := os.ReadFile(path)\n    if err != nil {\n        return err\n    }\n    text := strings.TrimSpace(string(bytes.TrimPrefix(data, []byte{0xEF, 0xBB, 0xBF})))\n    if !strings.Contains(text, \"[libdefaults]\") {\n        return fmt.Errorf(\"%s: missing required [libdefaults] section\", path)\n    }\n    if _, err := krb5config.Load(path); err != nil {\n        return fmt.Errorf(\"%s fails krb5 parsing: %w\", path, err)\n    }\n    return nil\n}","typeGuard":"func isParseableKrb5(path string) bool {\n    _, err := krb5config.Load(path)\n    return err == nil\n}","tryCatchPattern":"if err := cfg.Finalize(user, pass); err != nil {\n    if strings.Contains(err.Error(), \"load Kerberos config\") {\n        return fmt.Errorf(\"krb5.conf syntax error; validate with kinit or restore a known-good copy: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate krb5.conf with kinit or a parser before deployment.","Store krb5.conf in config management with a syntax check, not hand edits.","Re-save as UTF-8 without BOM with LF line endings if edited on Windows."],"tags":["kerberos","configuration","krb5","parse-error"],"backgroundTag":"config-parse-failed","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}