{"record":{"id":"1c7b61699ee9adef","repo":"666ghj/MiroFish","slug":"history-repository-does-not-match-configured-repos","errorCode":null,"errorMessage":"history repository does not match configured repository","messagePattern":"history repository does not match configured repository","errorType":"exception","errorClass":"StarHistoryError","httpStatus":null,"severity":"error","filePath":"scripts/star_history.py","lineNumber":362,"sourceCode":"def validate_state(state: Any) -> None:\n    if not isinstance(state, dict):\n        raise StarHistoryError(\"history state must be a JSON object\")\n    _expect_keys(\n        state,\n        {\n            \"schema_version\",\n            \"repository\",\n            \"timezone\",\n            \"ongoing_interval_days\",\n            \"reconstruction\",\n            \"snapshots\",\n        },\n        \"history state\",\n    )\n    if state[\"schema_version\"] != 1 or type(state[\"schema_version\"]) is not int:\n        raise StarHistoryError(\"unsupported history schema_version\")\n    if state[\"repository\"] != REPOSITORY:\n        raise StarHistoryError(\"history repository does not match configured repository\")\n    if state[\"timezone\"] != \"UTC\":\n        raise StarHistoryError(\"history timezone must be UTC\")\n    if (\n        state[\"ongoing_interval_days\"] != INTERVAL_DAYS\n        or type(state[\"ongoing_interval_days\"]) is not int\n    ):\n        raise StarHistoryError(\n            f\"history interval must be exactly {INTERVAL_DAYS} days\"\n        )\n\n    reconstruction = state[\"reconstruction\"]\n    if not isinstance(reconstruction, dict):\n        raise StarHistoryError(\"reconstruction must be an object\")\n    _expect_keys(\n        reconstruction,\n        {\"method\", \"generated_at\", \"daily\"},\n        \"reconstruction\",\n    )","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/666ghj/MiroFish/blob/b5b53acc57189a4a42e44a23e149dc655c98fe82/scripts/star_history.py#L344-L380","documentation":"validate_state requires state['repository'] to equal the module constant REPOSITORY ('666ghj/MiroFish'); a mismatch raises StarHistoryError('history repository does not match configured repository'). The state file is per-repository — star histories are not comparable across repos — so importing another repo's state is refused rather than silently mixed.","triggerScenarios":"A state file built for a different repository (e.g. after changing REPOSITORY in the source, or copying a state file between checkouts), or a fork pointed at its own repo while reusing upstream state.","commonSituations":"Forking the project: REPOSITORY is edited but the old state/history JSON is kept; CI reusing a cached state artifact from a different repo checkout.","solutions":["Delete or move the old state file and let the script reconstruct history for the new repository","Or restore REPOSITORY in scripts/star_history.py to the repository the state was built for"],"exampleFix":"# before (scripts/star_history.py)\nREPOSITORY = \"666ghj/MiroFish\"\n# with a state file built for \"other/repo\"\n\n# after\nrm .star_history_state.json  # or the configured state path; rerun to rebuild","handlingStrategy":"validation","validationCode":"if state.get(\"repository\") != REPOSITORY:\n    raise StarHistoryError(f\"state belongs to {state.get('repository')!r}; this checkout tracks {REPOSITORY!r}\")","typeGuard":"def state_matches_repository(state: object) -> TypeGuard[dict]:\n    return isinstance(state, dict) and state.get(\"repository\") == REPOSITORY","tryCatchPattern":"try:\n    validate_state(state)\nexcept StarHistoryError as exc:\n    if \"repository does not match\" in str(exc):\n        regenerate_state_file()  # different repo's history cannot be reused\n    else:\n        raise","preventionTips":["When forking, delete the state file together with changing REPOSITORY","Keep state files per-checkout/per-repo; never share them across forks in CI caches"],"tags":["state-file","configuration","validation","star-history"],"backgroundTag":null,"analyzedSha":"b5b53acc57189a4a42e44a23e149dc655c98fe82","analyzedAt":"2026-08-14T22:29:33.146Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}