{"record":{"id":"1331e05c7a0efbb4","repo":"grafana/k6","slug":"length-of-named-algorithm-is-less-than-4-v","errorCode":null,"errorMessage":"length of named algorithm is less than 4: {v}","messagePattern":"length of named algorithm is less than 4: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/jwk.go","lineNumber":103,"sourceCode":"\t\treturn nil, fmt.Errorf(\"failed to extract algorithm: %w\", err)\n\t}\n\texported.Set(\"alg\", algV)\n\n\treturn exported, nil\n}\n\nfunc extractAlg(inAlg any, keyLen int) (string, error) {\n\tswitch alg := inAlg.(type) {\n\tcase hasHash:\n\t\tv := alg.hash()\n\t\tif len(v) < 4 {\n\t\t\treturn \"\", errors.New(\"length of hash algorithm is less than 4: \" + v)\n\t\t}\n\t\treturn \"HS\" + v[4:], nil\n\tcase hasAlg:\n\t\tv := alg.alg()\n\t\tif len(v) < 4 {\n\t\t\treturn \"\", errors.New(\"length of named algorithm is less than 4: \" + v)\n\t\t}\n\n\t\treturn fmt.Sprintf(\"A%d%s\", (8 * keyLen), v[4:]), nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported algorithm: %v\", inAlg)\n\t}\n}\n\n// ecJWK represents an EC JWK key.\n// It is used to unmarshal ECDSA and ECDH keys to and from JWK format.\ntype ecJWK struct {\n\t// Key type\n\tKty string `json:\"kty\"`\n\t// Canonical Curve\n\tCrv string `json:\"crv\"`\n\t// X coordinate\n\tX string `json:\"x\"`\n\t// Y coordinate","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/webcrypto/jwk.go#L85-L121","documentation":"Error \"length of named algorithm is less than 4: {v}\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/jwk.go:103 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}