{"record":{"id":"b10c87a10d78ac8f","repo":"jackc/pgx","slug":"authtype-not-recognized-d","errorCode":null,"errorMessage":"authType not recognized: %d","messagePattern":"authType not recognized: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgproto3/backend.go","lineNumber":285,"sourceCode":"//\t\t\tthe context.\n//\n// Since the Frontend does not know about the state of a backend, it is important\n// to call SetAuthType() after an authentication request is received by the Frontend.\nfunc (b *Backend) SetAuthType(authType uint32) error {\n\tswitch authType {\n\tcase AuthTypeOk,\n\t\tAuthTypeCleartextPassword,\n\t\tAuthTypeMD5Password,\n\t\tAuthTypeSCMCreds,\n\t\tAuthTypeGSS,\n\t\tAuthTypeGSSCont,\n\t\tAuthTypeSSPI,\n\t\tAuthTypeSASL,\n\t\tAuthTypeSASLContinue,\n\t\tAuthTypeSASLFinal:\n\t\tb.authType = authType\n\tdefault:\n\t\treturn fmt.Errorf(\"authType not recognized: %d\", authType)\n\t}\n\n\treturn nil\n}\n\n// SetMaxBodyLen sets the maximum length of a message body in octets.\n// If a message body exceeds this length, Receive will return an error.\n// This is useful for protecting against malicious clients that send\n// large messages with the intent of causing memory exhaustion.\n// The default value is 0.\n// If maxBodyLen is 0, then no maximum is enforced.\nfunc (b *Backend) SetMaxBodyLen(maxBodyLen int) {\n\tb.maxBodyLen = maxBodyLen\n}\n","sourceCodeStart":267,"sourceCodeEnd":300,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgproto3/backend.go#L267-L300","documentation":"The frontend told the backend to expect an authentication message type that pgproto3 does not recognize. Only the known AuthType* constants are accepted; the %d shows the rejected value.","triggerScenarios":"Thrown at pgproto3/backend.go:285 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the AuthType constants exported by pgproto3","Verify the auth type value against the PostgreSQL protocol spec","Ensure SetAuthType is called with the type from the received Authentication message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}