{"record":{"id":"2c0e6bb3e2590a66","repo":"grafana/k6","slug":"failed-to-marshal-record-reason-w","errorCode":null,"errorMessage":"failed to marshal record; reason: %w","messagePattern":"failed to marshal record; reason: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/data/data.go","lineNumber":148,"sourceCode":"\n\t// The builder function is passed to loadOrStore, which ensures it is only\n\t// executed once for a given name. This guarantees the underlying data is\n\t// initialized exactly once, even if multiple VUs call this function concurrently\n\t// with the same name.\n\tbuilder := func() (sharedArray, error) {\n\t\tvar arr []string\n\t\tfor {\n\t\t\trecord, err := r.Read()\n\t\t\tif errors.Is(err, io.EOF) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn sharedArray{}, fmt.Errorf(\"failed to read record; reason: %w\", err)\n\t\t\t}\n\n\t\t\tmarshaled, err := json.Marshal(record)\n\t\t\tif err != nil {\n\t\t\t\treturn sharedArray{}, fmt.Errorf(\"failed to marshal record; reason: %w\", err)\n\t\t\t}\n\n\t\t\tarr = append(arr, string(marshaled))\n\t\t}\n\n\t\treturn sharedArray{arr: arr}, nil\n\t}\n\n\tarray, err := d.shared.loadOrStore(name, builder)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn func() *sobek.Object {\n\t\treturn array.wrap(rt).ToObject(rt)\n\t}, nil\n}\n","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/data/data.go#L130-L166","documentation":"Error \"failed to marshal record; reason: %w\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/data/data.go:148 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"}