{"record":{"id":"10423f02b4be9450","repo":"dotnet/aspnetcore","slug":"unknown-passkey-operation-this-attrs-operation","errorCode":null,"errorMessage":"Unknown passkey operation '${this.attrs.operation}'.","messagePattern":"Unknown passkey operation '(.+?)'\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js","lineNumber":77,"sourceCode":"    }\n\n    disconnectedCallback() {\n        this.abortController?.abort();\n    }\n\n    async obtainCredential(useConditionalMediation, signal) {\n        if (!browserSupportsPasskeys) {\n            throw new Error('Some passkey features are missing. Please update your browser.');\n        }\n\n        if (this.attrs.operation === 'Create') {\n            return await createCredential(signal);\n        } else if (this.attrs.operation === 'Request') {\n            const email = new FormData(this.internals.form).get(this.attrs.emailName);\n            const mediation = useConditionalMediation ? 'conditional' : undefined;\n            return await requestCredential(email, mediation, signal);\n        } else {\n            throw new Error(`Unknown passkey operation '${this.attrs.operation}'.`);\n        }\n    }\n\n    async obtainAndSubmitCredential(useConditionalMediation = false) {\n        this.abortController?.abort();\n        this.abortController = new AbortController();\n        const signal = this.abortController.signal;\n        const formData = new FormData();\n        try {\n            const credential = await this.obtainCredential(useConditionalMediation, signal);\n            const credentialJson = JSON.stringify(credential);\n            formData.append(`${this.attrs.name}.CredentialJson`, credentialJson);\n        } catch (error) {\n            if (error.name === 'AbortError') {\n                // The user explicitly canceled the operation - return without error.\n                return;\n            }\n            console.error(error);","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/294cab2f9b2e03af6b953820c7ab497c3c8b7ad9/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/Shared/PasskeySubmit.razor.js#L59-L95","documentation":"Thrown by obtainCredential when this.attrs.operation is neither 'Create' nor 'Request'. The operation is read once in connectedCallback from the element's 'operation' attribute (PasskeySubmit.razor.js:46); a missing, misspelled, or differently-cased value falls through to the else branch.","triggerScenarios":"Rendering <passkey-submit> without an operation attribute; using operation=\"create\" (lowercase) or operation=\"login\"/\"register\"; a typo like operation=\"Reqest\"; dynamically setting the attribute after connectedCallback (it is only read on connect).","commonSituations":"Template authoring mistake; casing mismatch (the code is case-sensitive); changing the attribute post-mount without re-reading; copy of the component that drops the attribute.","solutions":["Set operation=\"Create\" or operation=\"Request\" exactly (case-sensitive) on every <passkey-submit> usage.","If the attribute may change dynamically, re-read it in obtainCredential rather than caching in connectedCallback.","Add a server-side/component assertion that the operation attribute is one of the two allowed values.","Default to a known operation when the attribute is absent if that fits your UX."],"exampleFix":"// before\n<passkey-submit name=\"...\" /> <!-- missing operation -->\n\n// after\n<passkey-submit operation=\"Create\" name=\"...\" />","handlingStrategy":"validation","validationCode":"const VALID_OPS = new Set(['Create','Request']);\nfunction validOperation(op) { return VALID_OPS.has(op); }","typeGuard":"type PasskeyOp = 'Create' | 'Request';\nfunction isPasskeyOp(v: any): v is PasskeyOp { return v === 'Create' || v === 'Request'; }","tryCatchPattern":"null","preventionTips":["Always set operation with the exact casing on <passkey-submit>.","Assert the attribute at render/build time.","Re-read the attribute if it can change dynamically."],"tags":["blazor","passkeys","configuration","attributes","validation"],"analyzedSha":"294cab2f9b2e03af6b953820c7ab497c3c8b7ad9","analyzedAt":"2026-08-06T20:08:02.189Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}