abhigyanpatwari/GitNexus · error · SandboxError
transcript artifact byte count must be an integer
Error message
transcript artifact byte count must be an integer
What it means
The 'bytes' field must be a real integer. bool is explicitly rejected (`isinstance(expected_size, bool)`) even though bool subclasses int in Python, because True/False would silently coerce to 1/0 and bypass the size bound. float, str, and None are rejected for the same reason: the size bound must be exact.
Source
Thrown at eval/workflow_bench/evolve.py:338
if transcript and stat.S_IMODE(metadata.st_mode) & 0o077:
raise SandboxError(f"transcript artifact parent must be owner-only: {current}")
return root / Path(*relative.parts)
def _transcript_artifact_metadata(metadata: Any) -> tuple[str, str, int]:
"""Validate transcript metadata without touching any host path."""
if not isinstance(metadata, dict) or set(metadata) != {"path", "sha256", "bytes", "source"}:
raise SandboxError("transcript artifact metadata must contain only path, sha256, bytes, and source")
relative = metadata["path"]
expected_digest = metadata["sha256"]
expected_size = metadata["bytes"]
if metadata["source"] != runner_sessions.PARENT_EVENT_STREAM_SOURCE:
raise SandboxError("transcript artifact source is not the parent event stream")
if not isinstance(relative, str) or not re.fullmatch(r"[0-9a-f]{64}", str(expected_digest)):
raise SandboxError("transcript artifact metadata is malformed")
if not isinstance(expected_size, int) or isinstance(expected_size, bool):
raise SandboxError("transcript artifact byte count must be an integer")
if expected_size < 0 or expected_size > runner.MAX_TRANSCRIPT_BYTES:
raise SandboxError("transcript artifact exceeds the bounded run-output limit")
return relative, expected_digest, expected_size
def _normalized_transcript_artifact_path(relative_value: str) -> str:
"""Apply the transcript path contract without touching the filesystem."""
relative = PurePosixPath(relative_value)
if (
relative.is_absolute()
or len(relative.parts) != 2
or relative.parts[0] != "transcripts"
or any(part in {"", ".", ".."} for part in relative.parts)
):
raise SandboxError(f"unsafe results artifact path: {relative_value!r}")
return relative.as_posix()
View on GitHub (pinned to d540b00184)
Solutions
- Write bytes as a Python int: `len(content)` or `path.stat().st_size`.
- Validate before serializing: `assert isinstance(n, int) and not isinstance(n, bool)`.
- Re-encode the row with json.dumps after coercing `int(size)`.
Example fix
# before
{"path": "transcripts/r.json", "sha256": "<64hex>", "bytes": True, "source": "parent-captured-stream-json"}
# after
size = path.stat().st_size
assert isinstance(size, int) and not isinstance(size, bool)
row = {"path": "transcripts/r.json", "sha256": digest, "bytes": size, "source": PARENT_EVENT_STREAM_SOURCE} Defensive patterns
Strategy: type-guard
Validate before calling
def is_real_int_bytes(value: object) -> bool:
return isinstance(value, int) and not isinstance(value, bool) and value >= 0 Type guard
def is_nonneg_python_int(value: object) -> TypeGuard[int]:
# bool is a subclass of int; exclude it explicitly.
return isinstance(value, int) and not isinstance(value, bool) Prevention
- Always set bytes to path.stat().st_size (a real int).
- Assert `isinstance(n, int) and not isinstance(n, bool)` before serializing.
- Reject JSON where numbers were stringified; re-encode with json.dumps after int coercion.
When it happens
Trigger: bytes = true/false (e.g. a flag mis-serialized into the field); bytes = 12.0 (float); bytes = '12' (JSON string); bytes = None; a NumPy int that is not a Python int.
Common situations: Schema drift where a boolean flag overwrote the size; JSON decoded with non-strict numerics; a third-party writer that stringified numbers.
Related errors
- transcript artifact metadata must contain only path, sha256,
- transcript artifact metadata is malformed
- transcript artifact source is not the parent event stream
- transcript artifact exceeds the bounded run-output limit
- {label} is unavailable: {path}: {exc}
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/6e3b129566de3fd8.
Report an issue: GitHub.