{"id":"cd0efb4334db74fe","repo":"jackc/pgx","slug":"kerberos-error-no-gssapi-provider-registered-see","errorCode":null,"errorMessage":"kerberos error: no GSSAPI provider registered, see https://github.com/otan/gopgkrb5","messagePattern":"kerberos error: no GSSAPI provider registered, see https://github\\.com/otan/gopgkrb5","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgconn/krb5.go","lineNumber":38,"sourceCode":"//\timport \"github.com/otan/gopgkrb5\"\n//\n//\tfunc init() {\n//\t\tpgconn.RegisterGSSProvider(func() (pgconn.GSS, error) { return gopgkrb5.NewGSS() })\n//\t}\nfunc RegisterGSSProvider(newGSSArg NewGSSFunc) {\n\tnewGSS = newGSSArg\n}\n\n// GSS provides GSSAPI authentication (e.g., Kerberos).\ntype GSS interface {\n\tGetInitToken(host, service string) ([]byte, error)\n\tGetInitTokenFromSPN(spn string) ([]byte, error)\n\tContinue(inToken []byte) (done bool, outToken []byte, err error)\n}\n\nfunc (c *PgConn) gssAuth() error {\n\tif newGSS == nil {\n\t\treturn errors.New(\"kerberos error: no GSSAPI provider registered, see https://github.com/otan/gopgkrb5\")\n\t}\n\tcli, err := newGSS()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar nextData []byte\n\tif c.config.KerberosSpn != \"\" {\n\t\t// Use the supplied SPN if provided.\n\t\tnextData, err = cli.GetInitTokenFromSPN(c.config.KerberosSpn)\n\t} else {\n\t\t// Allow the kerberos service name to be overridden\n\t\tservice := \"postgres\"\n\t\tif c.config.KerberosSrvName != \"\" {\n\t\t\tservice = c.config.KerberosSrvName\n\t\t}\n\t\tnextData, err = cli.GetInitToken(c.config.Host, service)\n\t}","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgconn/krb5.go#L20-L56","documentation":"Error \"kerberos error: no GSSAPI provider registered, see https://github.com/otan/gopgkrb5\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgconn/krb5.go:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}