{"record":{"id":"53a72a7c7f3d9da3","repo":"gravitational/teleport","slug":"webauthn-error-code-v-v","errorCode":null,"errorMessage":"webauthn error code %v: %v","messagePattern":"webauthn error code (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/auth/webauthnwin/webauthn_windows.go","lineNumber":227,"sourceCode":"\t\tAttestationResponse: wantypes.AuthenticatorAttestationResponse{\n\t\t\tAuthenticatorResponse: wantypes.AuthenticatorResponse{\n\t\t\t\tClientDataJSON: in.jsonEncodedClientData,\n\t\t\t},\n\t\t\tAttestationObject: bytesFromCBytes(out.cbAttestationObject, out.pbAttestationObject),\n\t\t},\n\t}, nil\n}\n\nfunc getErrorNameOrLastErr(in uintptr, lastError error) error {\n\tret := webAuthNGetErrorName(in)\n\tif ret == 0 {\n\t\tif lastError != syscall.Errno(0) {\n\t\t\treturn fmt.Errorf(\"webauthn error code %v and syscall err: %v\", in, lastError)\n\t\t}\n\t\treturn fmt.Errorf(\"webauthn error code %v\", in)\n\t}\n\terrString := windows.UTF16PtrToString((*uint16)(unsafe.Pointer(ret)))\n\treturn fmt.Errorf(\"webauthn error code %v: %v\", in, errString)\n}\n\nfunc isUVPlatformAuthenticatorAvailable() (bool, error) {\n\tvar out bool\n\tret, err := webAuthNIsUserVerifyingPlatformAuthenticatorAvailable(&out)\n\tif err != nil {\n\t\treturn false, getErrorNameOrLastErr(ret, err)\n\t}\n\treturn out, nil\n}\n\n// bytesFromCBytes gets slice of bytes from C type and copies it to new slice\n// so that it won't interfere when main objects is free.\nfunc bytesFromCBytes(size uint32, p *byte) []byte {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tif *p == 0 {","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/gravitational/teleport/blob/1283425b60ec5f60d509ba4c791183d452923ff7/lib/auth/webauthnwin/webauthn_windows.go#L209-L245","documentation":"getErrorNameOrLastErr formats failures from the native Windows WebAuthn API: if WebAuthNGetErrorName cannot produce a message for the HRESULT, the raw error code (plus syscall error, if any) is formatted into this message.","triggerScenarios":"Thrown at lib/auth/webauthnwin/webauthn_windows.go:227 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Look up the WebAuthn HRESULT code in Microsoft's WebAuthN documentation to identify the failure","Verify the authenticator and Windows version support WebAuthn","Retry the operation; some codes are transient (e.g. user cancellation or timeout)"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1283425b60ec5f60d509ba4c791183d452923ff7","analyzedAt":"2026-09-02T04:06:41.601Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}