{"record":{"id":"ef3c844da4ab4468","repo":"grafana/k6","slug":"failed-to-parse-elliptic-curve-w","errorCode":null,"errorMessage":"failed to parse elliptic curve: %w","messagePattern":"failed to parse elliptic curve: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/jwk.go","lineNumber":234,"sourceCode":"\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 {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to decode Y coordinate: %w\", err)\n\t}\n\n\tpk := &ecdsa.PublicKey{\n\t\tCurve: crv,\n\t\tX:     new(big.Int).SetBytes(x),\n\t\tY:     new(big.Int).SetBytes(y),\n\t}\n","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/webcrypto/jwk.go#L216-L252","documentation":"Returned by importECDSAJWK when the JWK's `crv` field names a curve that pickEllipticCurve does not recognize. Only P-256, P-384 and P-521 (the standard JWK crv identifiers) are supported for EC key import; anything else — including X25519 or a typo — fails here after basic field validation passed.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/jwk.go:233 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use crv values 'P-256', 'P-384' or 'P-521' in the JWK","For X25519 keys use the raw import format with the X25519 algorithm instead of jwk"],"exampleFix":null,"handlingStrategy":"validation","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"}