{"record":{"id":"06b94f4c9235c7a1","repo":"moonD4rk/HackBrowserData","slug":"unsupported-dump-version-q-this-build-expects-q","errorCode":null,"errorMessage":"unsupported dump version %q (this build expects %q)","messagePattern":"unsupported dump version %q \\(this build expects %q\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"masterkey/dump.go","lineNumber":81,"sourceCode":"func (d Dump) WriteJSON(w io.Writer) error {\n\tenc := json.NewEncoder(w)\n\tenc.SetIndent(\"\", \"  \")\n\tif err := enc.Encode(d); err != nil {\n\t\treturn fmt.Errorf(\"encode dump: %w\", err)\n\t}\n\treturn nil\n}\n\n// ReadJSON parses a Dump and rejects any version this build can't interpret — a silent misparse of an\n// unrecognized schema is worse than a clear error.\nfunc ReadJSON(r io.Reader) (Dump, error) {\n\tvar d Dump\n\tdec := json.NewDecoder(r)\n\tif err := dec.Decode(&d); err != nil {\n\t\treturn Dump{}, fmt.Errorf(\"decode dump: %w\", err)\n\t}\n\tif d.Version != DumpVersion {\n\t\treturn Dump{}, fmt.Errorf(\"unsupported dump version %q (this build expects %q)\", d.Version, DumpVersion)\n\t}\n\treturn d, nil\n}\n","sourceCodeStart":63,"sourceCodeEnd":85,"githubUrl":"https://github.com/moonD4rk/HackBrowserData/blob/0503d04d7a8d0379d060268a74f1b149e5a0aad5/masterkey/dump.go#L63-L85","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-extract the dump using a tool build whose DumpVersion matches the reader.","Check the dump's version field against this build's DumpVersion and upgrade or downgrade the binary accordingly.","If the version is legitimately compatible, bump the constant or add a migration path in the source before removing the check.","Never hand-edit the version field to bypass the check — the schema may differ in other ways."],"exampleFix":"// before\nd, err := masterkey.ReadJSON(f)\n// after - check the version up front for a friendlier message\nraw, _ := io.ReadAll(f)\nvar probe struct{ Version string `json:\"version\"` }\n_ = json.Unmarshal(raw, &probe)\nif probe.Version != masterkey.DumpVersion {\n\tlog.Fatalf(\"dump version %q but tool expects %q; re-extract with matching build\", probe.Version, masterkey.DumpVersion)\n}\nd, err := masterkey.ReadJSON(bytes.NewReader(raw))","handlingStrategy":"validation","validationCode":"var probe struct{ Version string `json:\"version\"` }\nif err := json.Unmarshal(raw, &probe); err != nil {\n\treturn err\n}\nif probe.Version != masterkey.DumpVersion {\n\treturn fmt.Errorf(\"dump version %q, tool expects %q; re-extract\", probe.Version, masterkey.DumpVersion)\n}","typeGuard":null,"tryCatchPattern":"d, err := masterkey.ReadJSON(f)\nif err != nil {\n\tif strings.Contains(err.Error(), \"unsupported dump version\") {\n\t\tlog.Fatalf(\"dump was written by a different build; re-extract with this version (%v)\", err)\n\t}\n\treturn err\n}","preventionTips":["Pin dump files to the tool version that created them; re-extract after upgrades.","Keep DumpVersion in sync across builds that must share dumps.","Include the tool version in dump filenames to catch mismatches early."],"tags":["json","versioning","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"0503d04d7a8d0379d060268a74f1b149e5a0aad5","analyzedAt":"2026-09-06T13:38:28.707Z","contentChangedAt":"2026-09-06T13:38:28.707Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}