{"record":{"id":"8839862c397f31e1","repo":"grafana/k6","slug":"failed-to-parse-input-as-ec-jwk-key-w","errorCode":null,"errorMessage":"failed to parse input as EC JWK key: %w","messagePattern":"failed to parse input as EC JWK key: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/jwk.go","lineNumber":225,"sourceCode":"\t}\n\n\texported.Set(\"crv\", curveParams.Name)\n\tcurveBits := curveParams.BitSize\n\n\texported.Set(\"x\", base64URLEncode(x.Bytes()))\n\texported.Set(\"y\", base64URLEncode(y.Bytes()))\n\n\tif d != nil {\n\t\texported.Set(\"d\", encodeCurveBigInt(d, curveBits))\n\t}\n\n\treturn exported, nil\n}\n\nfunc importECDSAJWK(_ EllipticCurveKind, jsonKeyData []byte) (any, CryptoKeyType, error) {\n\tvar jwkKey ecJWK\n\tif err := json.Unmarshal(jsonKeyData, &jwkKey); err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to parse input as EC JWK key: %w\", err)\n\t}\n\n\tif err := jwkKey.validate(); err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"invalid EC JWK key: %w\", err)\n\t}\n\n\tcrv, err := pickEllipticCurve(jwkKey.Crv)\n\tif err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to parse elliptic curve: %w\", err)\n\t}\n\n\tx, err := base64URLDecode(jwkKey.X)\n\tif err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to decode X coordinate: %w\", err)\n\t}\n\n\ty, err := base64URLDecode(jwkKey.Y)\n\tif err != nil {","sourceCodeStart":207,"sourceCodeEnd":243,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/webcrypto/jwk.go#L207-L243","documentation":"Returned by importECDSAJWK when the data passed to crypto.subtle.importKey with format 'jwk' and an EC algorithm is not valid JSON — json.Unmarshal of the bytes into the ecJWK struct failed. This is a pure deserialization failure: the input never reaches field validation.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/jwk.go:224 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass serialized JWK JSON, e.g. JSON.stringify({kty:'EC', crv:'P-256', x:'...', y:'...'})","Verify the key string is not truncated or double-encoded (e.g. base64 of JSON)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}