{"id":"950b0417353c00e5","repo":"jackc/pgx","slug":"authtypesspi-is-unimplemented","errorCode":null,"errorMessage":"AuthTypeSSPI is unimplemented","messagePattern":"AuthTypeSSPI is unimplemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgproto3/frontend.go","lineNumber":445,"sourceCode":"\t\treturn nil, errors.New(\"authentication message too short\")\n\t}\n\tf.authType = binary.BigEndian.Uint32(src[:4])\n\n\tswitch f.authType {\n\tcase AuthTypeOk:\n\t\treturn &f.authenticationOk, nil\n\tcase AuthTypeCleartextPassword:\n\t\treturn &f.authenticationCleartextPassword, nil\n\tcase AuthTypeMD5Password:\n\t\treturn &f.authenticationMD5Password, nil\n\tcase AuthTypeSCMCreds:\n\t\treturn nil, errors.New(\"AuthTypeSCMCreds is unimplemented\")\n\tcase AuthTypeGSS:\n\t\treturn &f.authenticationGSS, nil\n\tcase AuthTypeGSSCont:\n\t\treturn &f.authenticationGSSContinue, nil\n\tcase AuthTypeSSPI:\n\t\treturn nil, errors.New(\"AuthTypeSSPI is unimplemented\")\n\tcase AuthTypeSASL:\n\t\treturn &f.authenticationSASL, nil\n\tcase AuthTypeSASLContinue:\n\t\treturn &f.authenticationSASLContinue, nil\n\tcase AuthTypeSASLFinal:\n\t\treturn &f.authenticationSASLFinal, nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown authentication type: %d\", f.authType)\n\t}\n}\n\n// GetAuthType returns the authType used in the current state of the frontend.\n// See SetAuthType for more information.\nfunc (f *Frontend) GetAuthType() uint32 {\n\treturn f.authType\n}\n\nfunc (f *Frontend) ReadBufferLen() int {","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgproto3/frontend.go#L427-L463","documentation":"Returned by the authentication dispatcher when the server requests SSPI authentication (auth type 9). SSPI is a Windows-only integrated-auth mechanism; pgx/pgproto3 does not implement it, so the handshake fails. The error is a deliberate non-implementation for non-targeted platforms.","triggerScenarios":"During the auth handshake, the server sends an Authentication message with type code 9 (AuthTypeSSPI), and findAuthenticationMessageType returns this error. Triggered by a server whose pg_hba.conf specifies `sspi` for the connecting client.","commonSituations":"Connecting to a Windows PostgreSQL server configured for SSPI integrated auth from a non-Windows client (or any client using pgx). Cross-platform tools that assume SSPI will work everywhere hit this on Linux/macOS.","solutions":["Reconfigure the server's pg_hba.conf to use an auth method pgx supports: scram-sha-256, md5, password, trust, or peer.","If SSPI is required organisation-wide, route connections through a proxy/pooler that terminates SSPI upstream and presents scram/md5 to pgx.","Verify the pg_hba.conf line matching the client's host/user actually requires the method you intend.","Reload PostgreSQL config after editing: `SELECT pg_reload_conf();`."],"exampleFix":"# before — pg_hba.conf on the Windows server\nhost  all  all  0.0.0.0/0  sspi\n\n# after — use scram-sha-256 over TCP\nhost  all  all  0.0.0.0/0  scram-sha-256","handlingStrategy":"fallback","validationCode":"null","typeGuard":"func isUnsupportedAuth(err error) bool {\n    return err != nil && (strings.Contains(err.Error(), \"AuthTypeSSPI is unimplemented\") ||\n        strings.Contains(err.Error(), \"AuthTypeSCMCreds is unimplemented\"))\n}","tryCatchPattern":"conn, err := pgx.Connect(ctx, connString)\nif err != nil && isUnsupportedAuth(err) {\n    // Windows SSPI is not implemented in pgx — reconfigure the server.\n    log.Printf(\"SSPI unsupported by pgx; set pg_hba.conf to scram-sha-256/md5/password/trust for this client\")\n    return err\n}","preventionTips":["Avoid SSPI in pg_hba.conf for non-Windows or cross-platform clients; use scram-sha-256 over TCP instead.","If SSPI is organisation-mandated, terminate it at a proxy/pooler that re-authenticates to pgx.","Document the supported auth matrix so clients connect with a method pgx implements."],"tags":["pgproto3","authentication","unsupported","configuration","sspi","windows","connection"],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}