666ghj/MiroFish · error · StarHistoryError
{label} exceeded the size limit
Error message
{label} exceeded the size limit What it means
_read_limited reads limit+1 bytes up front; if the payload exceeds the cap (MAX_STATE_BYTES = 5,000,000 for history state), it raises '{label} exceeded the size limit'. This bounds memory use and rejects absurd state files before JSON parsing.
Source
Thrown at scripts/star_history.py:506
raise StarHistoryError("output file cannot be a symbolic link")
try:
resolved_parent = target.parent.resolve(strict=False)
resolved_parent.relative_to(root)
except (OSError, ValueError) as exc:
raise StarHistoryError("output path escaped the workspace") from exc
return resolved_parent / target.name
def _read_limited(path: Path, limit: int, label: str) -> bytes:
try:
with path.open("rb") as handle:
payload = handle.read(limit + 1)
except FileNotFoundError as exc:
raise StarHistoryError(f"{label} is missing") from exc
except OSError as exc:
raise StarHistoryError(f"could not read {label}") from exc
if len(payload) > limit:
raise StarHistoryError(f"{label} exceeded the size limit")
return payload
def load_star_count_file(path: Path) -> int:
"""Read a tiny, symlink-safe decimal count produced by the fetch-only step."""
flags = os.O_RDONLY
if hasattr(os, "O_NOFOLLOW"):
flags |= os.O_NOFOLLOW
try:
descriptor = os.open(path, flags)
except OSError as exc:
raise StarHistoryError("Star count file is missing or unsafe") from exc
try:
metadata = os.fstat(descriptor)
if not stat.S_ISREG(metadata.st_mode):
raise StarHistoryError("Star count file is not a regular file")
payload = os.read(descriptor, MAX_COUNT_FILE_BYTES + 1)View on GitHub (pinned to b5b53acc57)
Solutions
- Check the size: stat -c %s .github/star-history/history.json
- If legitimate growth, the data must be trimmed per the tool's model (regenerate state via backfill, or prune per the project's state format) — do not blindly raise MAX_STATE_BYTES unless you own the script
- Diff against git history to detect accidental duplication/appending
- Regenerate the state from the fetch/backfill step
Example fix
# inspect what inflated the file
python -c "import json;d=json.load(open('.github/star-history/history.json'));print(len(d['snapshots']),len(d['reconstruction']['points']))" Defensive patterns
Strategy: validation
Validate before calling
MAX = 5_000_000
size = (ws / '.github/star-history/history.json').stat().st_size
if size > MAX: raise RuntimeError(f'state is {size} bytes (cap {MAX})') Try / catch
except StarHistoryError as e:
if str(e) == "history state exceeded the size limit':
audit_and_regenerate(ws) # detect duplication vs real growth
raise Prevention
- Monitor state file size across releases
- Never append/concatenate into history.json
- Regenerate state rather than hand-merging
- Commit after each tool write so git bisect can find inflation
When it happens
Trigger: history.json grows past 5 MB — many daily reconstruction points and snapshots accumulated over years, or the file was corrupted/appended with junk. Reading limit+1 bytes guarantees detection even when the file is exactly one byte over.
Common situations: Long-lived repositories with tens of thousands of stargazers and years of snapshots, accidentally committing a concatenated/merged state file, or hand-edits that duplicated content.
Related errors
- 模拟不存在: {simulation_id}
- GitHub API response exceeded the size limit
- output directory cannot be a symbolic link
- output file cannot be a symbolic link
- could not create output directory
AI-assisted analysis of 666ghj/MiroFish@b5b53acc57 (2026-08-14).
Data as JSON: /api/errors/6f5289d596465422.
Report an issue: GitHub.