Graphify-Labs/graphify · error · ValueError
ingest: {exc}
Error message
ingest: {exc} What it means
Raised by graphify's URL ingest when validate_url(url) rejects the input before any network activity. The ingest pipeline classifies the URL (pdf/image/audio/tweet/arxiv/webpage) and first runs strict validation; a ValueError from that check is re-raised prefixed with 'ingest:' and chained to the original, preserving the specific reason (bad scheme, malformed host, SSRF-guard rejection, etc.).
Source
Thrown at graphify/ingest.py:230
filename = _safe_filename(url, suffix)
out_path = target_dir / filename
out_path.write_bytes(safe_fetch(url))
return out_path
def ingest(url: str, target_dir: Path, author: str | None = None, contributor: str | None = None) -> Path:
"""
Fetch a URL and save it into target_dir as a graphify-ready file.
Returns the path of the saved file.
"""
target_dir.mkdir(parents=True, exist_ok=True)
url_type = _detect_url_type(url)
try:
validate_url(url)
except ValueError as exc:
raise ValueError(f"ingest: {exc}") from exc
try:
if url_type == "pdf":
out = _download_binary(url, ".pdf", target_dir)
print(f"Downloaded PDF: {out.name}")
return out
if url_type == "image":
suffix = Path(urllib.parse.urlparse(url).path).suffix or ".jpg"
out = _download_binary(url, suffix, target_dir)
print(f"Downloaded image: {out.name}")
return out
if url_type == "youtube":
from graphify.transcribe import download_audio
out = download_audio(url, target_dir)
print(f"Downloaded audio: {out.name}")
return outView on GitHub (pinned to 7fe58b0b0f)
Solutions
- Read the tail of the message — the original ValueError names the exact validation failure
- Normalize the URL: add the https:// scheme, strip stray whitespace/quotes
- If the target is legitimately internal, check validate_url's SSRG/allowlist options before relaxing anything — the block is a security guard
Example fix
# before
ingest("example.com/paper.pdf", out_dir) # ValueError: ingest: missing scheme
# after
ingest("https://example.com/paper.pdf", out_dir) Defensive patterns
Strategy: validation
Validate before calling
from urllib.parse import urlparse
u = urlparse(url)
if u.scheme not in ("http", "https") or not u.hostname:
raise SystemExit(f"refusing URL {url!r}: needs an http(s) scheme and host")
from graphify.ingest import ingest
ingest(url, target_dir) Try / catch
try:
ingest(url, target_dir)
except ValueError as e:
if str(e).startswith("ingest:"):
raise SystemExit(f"bad URL {url!r}: {e}") # fix the input, don't retry
raise Prevention
- Normalize URLs (add scheme, strip whitespace) before passing to ingest
- Never disable the SSRF validation to 'make it work' - rewrite the input instead
- Fail fast on ValueError in batch ingesters: validation errors never self-heal
When it happens
Trigger: Calling ingest(url, target_dir) — or `graphify ingest <url>` — with a URL validate_url refuses: missing scheme, non-http(s) protocol, unparsable host, or an address the SSRF protections block.
Common situations: Pasting bare domains ('example.com/doc.pdf') without https://; passing file:// or other disallowed schemes; trailing punctuation from copy-paste; URLs blocked because they resolve to private/loopback ranges.
Related errors
- Blocked URL scheme '{parsed.scheme}' - only http and https a
- Blocked cloud metadata endpoint '{hostname}'. Got: {url!r}
- Google Workspace shortcut {path} does not include a Drive fi
- ingest: failed to fetch {url!r}: {exc}
- Blocked private/internal IP {addr} (resolved from '{hostname
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/ec5f218937464954.
Report an issue: GitHub.