{"record":{"id":"80dc82e4ecd08554","repo":"grafana/k6","slug":"invalid-parameter-type-s","errorCode":null,"errorMessage":"invalid parameter type : %s","messagePattern":"invalid parameter type : (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/element_handle_options.go","lineNumber":221,"sourceCode":"\t}\n}\n\n// addFile to the struct. Input value can only be a file descriptor object.\nfunc (f *Files) addFile(ctx context.Context, file sobek.Value) error {\n\tif common.IsNullish(file) {\n\t\treturn nil\n\t}\n\trt := k6ext.Runtime(ctx)\n\tfileType := file.ExportType()\n\tswitch fileType.Kind() {\n\tcase reflect.Map: // file descriptor object\n\t\tvar parsedFile File\n\t\tif err := rt.ExportTo(file, &parsedFile); err != nil {\n\t\t\treturn fmt.Errorf(\"parsing file descriptor: %w\", err)\n\t\t}\n\t\tf.Payload = append(f.Payload, &parsedFile)\n\tdefault:\n\t\treturn fmt.Errorf(\"invalid parameter type : %s\", fileType.Kind().String())\n\t}\n\n\treturn nil\n}\n\n// Parse parses the Files struct from the given sobek.Value.\nfunc (f *Files) Parse(ctx context.Context, files sobek.Value) error {\n\trt := k6ext.Runtime(ctx)\n\tif common.IsNullish(files) {\n\t\treturn nil\n\t}\n\n\toptsType := files.ExportType()\n\tswitch optsType.Kind() {\n\tcase reflect.Slice: // array of filePaths or array of file descriptor objects\n\t\tgopts := files.ToObject(rt)\n\t\tfor _, k := range gopts.Keys() {\n\t\t\terr := f.addFile(ctx, gopts.Get(k))","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/common/element_handle_options.go#L203-L239","documentation":"Returned by Files.addFile when a setInputFiles payload member is neither nullish nor a map (file descriptor object) — e.g. a bare string, number, or array. The default branch of a type switch; the rejected Go reflect kind of the value is included in the message.","triggerScenarios":"Thrown at internal/js/modules/k6/browser/common/element_handle_options.go:237 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass file entries as objects like {name:'a.txt', mimeType:'text/plain', data: base64}, or omit them","Wrap plain data in a descriptor object instead of passing raw strings/numbers","Consult the k6 setInputFiles docs for accepted shapes"],"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"}