666ghj/MiroFish · error · StarHistoryError
history repository does not match configured repository
Error message
history repository does not match configured repository
What it means
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.
Source
Thrown at scripts/star_history.py:362
def validate_state(state: Any) -> None:
if not isinstance(state, dict):
raise StarHistoryError("history state must be a JSON object")
_expect_keys(
state,
{
"schema_version",
"repository",
"timezone",
"ongoing_interval_days",
"reconstruction",
"snapshots",
},
"history state",
)
if state["schema_version"] != 1 or type(state["schema_version"]) is not int:
raise StarHistoryError("unsupported history schema_version")
if state["repository"] != REPOSITORY:
raise StarHistoryError("history repository does not match configured repository")
if state["timezone"] != "UTC":
raise StarHistoryError("history timezone must be UTC")
if (
state["ongoing_interval_days"] != INTERVAL_DAYS
or type(state["ongoing_interval_days"]) is not int
):
raise StarHistoryError(
f"history interval must be exactly {INTERVAL_DAYS} days"
)
reconstruction = state["reconstruction"]
if not isinstance(reconstruction, dict):
raise StarHistoryError("reconstruction must be an object")
_expect_keys(
reconstruction,
{"method", "generated_at", "daily"},
"reconstruction",
)View on GitHub (pinned to b5b53acc57)
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
Example fix
# before (scripts/star_history.py) REPOSITORY = "666ghj/MiroFish" # with a state file built for "other/repo" # after rm .star_history_state.json # or the configured state path; rerun to rebuild
Defensive patterns
Strategy: validation
Validate before calling
if state.get("repository") != REPOSITORY:
raise StarHistoryError(f"state belongs to {state.get('repository')!r}; this checkout tracks {REPOSITORY!r}") Type guard
def state_matches_repository(state: object) -> TypeGuard[dict]:
return isinstance(state, dict) and state.get("repository") == REPOSITORY Try / catch
try:
validate_state(state)
except StarHistoryError as exc:
if "repository does not match" in str(exc):
regenerate_state_file() # different repo's history cannot be reused
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- history interval must be exactly {INTERVAL_DAYS} days
- {label} must use YYYY-MM-DDTHH:MM:SSZ
- {label} is not a valid UTC timestamp
- {label} contains missing or unknown fields
- history state must be a JSON object
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/1c7b61699ee9adef.
Report an issue: GitHub.