grafana/k6 · error
unknown file prefix `%s` for file `%s`
Error message
unknown file prefix `%s` for file `%s`
What it means
ReadArchive encountered a tar entry whose path inside the archive starts with a directory prefix that is neither a known filesystem ('https', 'file') nor a legacy 'files'/'scripts' directory. The archive is malformed or produced by an incompatible k6 version — the entry's prefix cannot be mapped to any filesystem.
Source
Thrown at lib/archive.go:181
case "files", "scripts": // old archives
// in old archives (pre 0.25.0) names without "_" at the beginning were https, the ones with "_" are local files
pfx = "https"
if len(name) >= 2 && name[0:2] == "/_" {
pfx = "file"
name = name[2:]
}
fallthrough
case "https", "file":
fileSystem := arc.getFs(pfx)
name = filepath.FromSlash(name)
if err = fsext.WriteFile(fileSystem, name, data, fs.FileMode(hdr.Mode)); err != nil { //nolint:gosec
return nil, err
}
if err = fileSystem.Chtimes(name, hdr.AccessTime, hdr.ModTime); err != nil {
return nil, err
}
default:
return nil, fmt.Errorf("unknown file prefix `%s` for file `%s`", pfx, normPath)
}
}
scheme, pathOnFs := getURLPathOnFs(arc.FilenameURL)
var err error
pathOnFs, err = url.PathUnescape(pathOnFs)
if err != nil {
return nil, err
}
err = fsext.WriteFile(arc.getFs(scheme), pathOnFs, arc.Data, 0o644) // TODO fix the mode ?
if err != nil {
return nil, err
}
return arc, nil
}
func normalizeAndAnonymizeURL(u *url.URL) {
if u.Scheme == "file" {View on GitHub (pinned to 01ffac6f24)
Solutions
- Regenerate the archive with a compatible k6 version (k6 archive script.js)
- Verify the .tar archive was not manually repacked or corrupted
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/archive.go:181 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/b2da1c749ac4a75a.
Report an issue: GitHub.