moonD4rk/HackBrowserData · error

unsupported dump version %q (this build expects %q)

Error message

unsupported dump version %q (this build expects %q)

What it means

ReadJSON rejects any dump whose Version field does not equal this build's DumpVersion constant. This is a deliberate guard: a silent misparse of an unrecognized dump schema is worse than a clear error, so unknown versions (including a missing version, which decodes to the empty string) are refused.

Source

Thrown at masterkey/dump.go:81

func (d Dump) WriteJSON(w io.Writer) error {
	enc := json.NewEncoder(w)
	enc.SetIndent("", "  ")
	if err := enc.Encode(d); err != nil {
		return fmt.Errorf("encode dump: %w", err)
	}
	return nil
}

// ReadJSON parses a Dump and rejects any version this build can't interpret — a silent misparse of an
// unrecognized schema is worse than a clear error.
func ReadJSON(r io.Reader) (Dump, error) {
	var d Dump
	dec := json.NewDecoder(r)
	if err := dec.Decode(&d); err != nil {
		return Dump{}, fmt.Errorf("decode dump: %w", err)
	}
	if d.Version != DumpVersion {
		return Dump{}, fmt.Errorf("unsupported dump version %q (this build expects %q)", d.Version, DumpVersion)
	}
	return d, nil
}

View on GitHub (pinned to 0503d04d7a)

Solutions

  1. Re-extract the dump using a tool build whose DumpVersion matches the reader.
  2. Check the dump's version field against this build's DumpVersion and upgrade or downgrade the binary accordingly.
  3. If the version is legitimately compatible, bump the constant or add a migration path in the source before removing the check.
  4. Never hand-edit the version field to bypass the check — the schema may differ in other ways.

Example fix

// before
d, err := masterkey.ReadJSON(f)
// after - check the version up front for a friendlier message
raw, _ := io.ReadAll(f)
var probe struct{ Version string `json:"version"` }
_ = json.Unmarshal(raw, &probe)
if probe.Version != masterkey.DumpVersion {
	log.Fatalf("dump version %q but tool expects %q; re-extract with matching build", probe.Version, masterkey.DumpVersion)
}
d, err := masterkey.ReadJSON(bytes.NewReader(raw))
Defensive patterns

Strategy: validation

Validate before calling

var probe struct{ Version string `json:"version"` }
if err := json.Unmarshal(raw, &probe); err != nil {
	return err
}
if probe.Version != masterkey.DumpVersion {
	return fmt.Errorf("dump version %q, tool expects %q; re-extract", probe.Version, masterkey.DumpVersion)
}

Try / catch

d, err := masterkey.ReadJSON(f)
if err != nil {
	if strings.Contains(err.Error(), "unsupported dump version") {
		log.Fatalf("dump was written by a different build; re-extract with this version (%v)", err)
	}
	return err
}

Prevention

When it happens

Trigger: Calling ReadJSON on a dump produced by a different build — either older tool output with an outdated DumpVersion or newer output with a version this binary doesn't know; also a dump missing the version field entirely.

Common situations: Upgrading hack-browser-data and reading old dump files; sharing dumps between machines running different versions; a dump generated by hand or by tests that omitted Version.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of moonD4rk/HackBrowserData@0503d04d7a (2026-09-06). Data as JSON: /api/errors/06b94f4c9235c7a1. Report an issue: GitHub.