# Why your web crawler missed pages and how to debug it

> Source: <https://spidra.io/blog/debug-missing-crawl-pages>
> Published: 2026-12-03 00:00:00+00:00

**Recommendation:** Write and normalize your expected URL list before crawling, then diff it against the crawl report and Map to assign each miss a cause before changing `max_pages`, paths or instructions.
More in the playbook "Retrieval and RAG": <https://wpnews.pro/playbooks/rag-retrieval>

You crawled a site and the output is missing pages you expected, or it's full of pages you never wanted. This tutorial shows why a crawler misses pages and how to find the cause. You'll write down the URLs you expected, run a crawl with [Spidra's crawler](https://spidra.io/ai-crawler), read its crawl report, compare it with Map, and get a table that says what happened to every missing URL and what to change.

You need Python, and a Spidra API key from the [quickstart](https://docs.spidra.io/quickstart) in the `SPIDRA_API_KEY` environment variable. If you're new to crawling with Spidra, the [Crawl API guide](https://spidra.io/blog/spidra-crawl-api-guide) covers the basics.

```
pip install spidra
```

## Every missing page is in one of six states

A crawler doesn't lose pages at random. For each URL you expected and didn't get, one of these happened:

| State | What happened | Where you see it | Usual fix | 
|---|---|---|---|
| Excluded | The crawl saw the link and declined it | The crawl report lists it with a reason | Your instruction, `include_paths` ,`exclude_paths` or the start URL | 
| Cut off | The crawl stopped at `max_pages` before reaching it | Map lists it, the crawl returned exactly `max_pages` pages, the report doesn't mention it | Raise `max_pages` or stop spending pages on things you don't want | 
| Not followed | The crawl never reached it, and it wasn't at the page limit | Map lists it, the report doesn't | Reword the instruction, or start from a page that links closer | 
| Undiscovered | Nothing links to it and the sitemap doesn't list it | Map doesn't list it either | Link it, add it to the sitemap, or scrape the URL directly | 
| Blocked | The site's `robots.txt` disallows it (with`respect_robots` on) or the page won't load for a bot | The report says `robots_txt` , or the page comes back failed | Honor the rule, or use Stealth Mode where that's appropriate | 
| Failed | The page was fetched but errored | The page has `status: "failed"` and an`error_message` | Scrape it again on its own | 

The rest of this post builds a script that puts every expected URL in one of these rows.

## Write the list of URLs you expect first

"**Missed pages**" only means something against a list. Without one you can only say "fewer than I hoped". Put the URLs in a text file, one per line. A sitemap, a Map result or your own knowledge of the site all work.

For this walkthrough, the goal is to crawl the Spidra blog and get its posts. The list is ten posts:

text

```
# the posts we expect a blog crawl to return
https://spidra.io/blog/spidra-search-api
https://spidra.io/blog/best-web-search-apis-ai-agents
https://spidra.io/blog/how-to-scrape-pdf-extract-json-api
https://spidra.io/blog/spidra-crawl-api-guide
https://spidra.io/blog/spidra-batch-scraping-api
https://spidra.io/blog/spidra-browser-actions-guide
https://spidra.io/blog/spidra-foreach-structured-output-batch-scrape
https://spidra.io/blog/scrape-structured-data
https://spidra.io/blog/authenticated-scraping-and-crawling
https://spidra.io/blog/captcha-solving-stealth-mode-crawling
```

Before comparing, normalize the URLs so `https://Example.com/a/` and `https://example.com/a` count as the same page. Start a file called `diagnose.py` with these imports and the two helpers. The later blocks append to it in the order shown:

``` python
# diagnose.py
import time
from dataclasses import dataclass
from urllib.parse import urlsplit
python
def normalize(url):
    """Compare URLs without fragments, a trailing slash or host case."""
    parts = urlsplit(url.strip())
    path = parts.path.rstrip("/") or "/"
    query = f"?{parts.query}" if parts.query else ""
    return f"{parts.scheme}://{parts.netloc.lower()}{path}{query}"

def load_expected(path):
    with open(path, encoding="utf-8") as f:
        lines = [line.strip() for line in f]
    return [normalize(line) for line in lines if line and not line.startswith("#")]
```

## Compare your list with Map

[Map](https://docs.spidra.io/map) lists the URLs Spidra can see on a site, from its sitemap and its links, without scraping them. Checking your list against it tells you whether the pages are discoverable at all. (If you want the broader picture of when to use Map, a crawl or a batch, [Map a website and scrape only the pages you need](https://spidra.io/blog/map-website-batch-scrape-selected-pages) covers it.)

``` python
# check_map.py
import os

from spidra import Spidra

from diagnose import load_expected, normalize

client = Spidra(api_key=os.environ["SPIDRA_API_KEY"])
expected = load_expected("expected_urls.txt")

site = client.map("https://spidra.io/blog", limit=500)
mapped = {normalize(link.url) for link in site.links}

print("Map found", site.total, "URLs")
print("expected", len(expected), "| in Map", sum(url in mapped for url in expected))
for url in expected:
    if url not in mapped:
        print("not in Map:", url)
```

Output:

```
Map found 17 URLs
expected 10 | in Map 10
```

All ten are in Map, so discovery isn't the problem here. If a URL had been missing, it would belong in the Undiscovered row: nothing links to it, so no crawl will find it either. Map only reports what the sitemap and the site's links expose, so that's the cue to scrape the URL directly.

## Read the crawl report

Every finished crawl has a [crawl report](https://docs.spidra.io/crawl) that explains what it did. The fields you need are:

- `understood_as` : the kind of page the crawl looked for, from your instruction. If it isn't what you meant, reword the instruction.
- `navigation_pages` : pages read only to find the ones you wanted. They aren't returned or charged.
- `skipped_urls` : the declined URLs themselves, each with its reason and the page it was found on. Up to 2,000 are kept per crawl, and you page through them with`limit` and`offset` .

The code below reads every skipped URL into a dictionary, and waits for the crawl to finish first:

``` python
def wait_for_crawl(client, job_id, every=5, tries=240):
    for _ in range(tries):
        job = client.get_crawl(job_id)
        if job.status in ("completed", "failed", "cancelled"):
            return job
        time.sleep(every)
    raise TimeoutError(f"crawl {job_id} is still running")

def read_skipped(client, job_id, page_size=500):
    """The report's counts, plus every skipped URL it recorded (up to 2,000 per crawl)."""
    skipped, offset = {}, 0
    while True:
        response = client.crawl_report(job_id, limit=page_size, offset=offset)
        report = response.report
        if report is None:
            raise RuntimeError("no crawl report yet: the crawl may still be running")
        for item in report.skipped_urls:
            skipped[normalize(item.url)] = item.reason
        if len(report.skipped_urls) < page_size:
            return report, skipped
        offset += page_size
```

`read_skipped` raises an error if there's no report yet (the crawl is still running, or it ran before reports existed).

The report only lists links the crawl saw and declined. A page the crawl never reached, because it ran out of `max_pages`, appears nowhere in it. That's why the next step also needs the Map result.

## Label each expected URL

First, a one-line remedy for each skip reason, the reasons that count as blocked, and a small record for each finding:

```
FIXES = {
    "not_relevant": "name the page type in crawl_instruction, or fence it with include_paths",
    "outside_start_path": "start higher up, or set crawl_entire_domain=True and add include_paths",
    "outside_domain": "set allow_subdomains=True if it is a subdomain of the same site",
    "include_pattern": "your include_paths does not match this URL: widen it",
    "exclude_pattern": "your exclude_paths matches this URL: narrow it",
    "file_type": "crawls skip images, video, archives and scripts: fetch the file directly",
    "other_version_or_language": "start from the version or language you want, or add its path to include_paths",
    "duplicate_page": "the content came back under another URL: update your checklist",
    "redirected_off_site": "the link leaves the site: scrape the destination directly",
    "robots_txt": "the site's robots.txt disallows it and respect_robots is on",
    "action_link": "links like add to cart or log out are never followed",
}
BLOCKED = {"robots_txt"}
@dataclass(frozen=True)
class Finding:
    url: str
    label: str       # returned, excluded, blocked, failed, cut_off, not_followed or undiscovered
    detail: str = ""
```

`classify` takes your list, the Map URLs, the pages the crawl returned, the skipped URLs and `max_pages`, and decides which row each expected URL belongs in:

``` python
def classify(expected, mapped, pages, skipped, max_pages):
    returned = {normalize(p.url): p for p in pages}
    mapped = {normalize(u) for u in mapped}
    wanted = set(expected)
    findings = []
    for url in expected:
        page = returned.get(url)
        if page and page.status == "success":
            findings.append(Finding(url, "returned"))
        elif page:
            findings.append(Finding(url, "failed", page.error_message or "no error message"))
        elif url in skipped:
            reason = skipped[url]
            label = "blocked" if reason in BLOCKED else "excluded"
            findings.append(Finding(url, label, f"{reason}: {FIXES.get(reason, 'see the crawl report')}"))
        elif url not in mapped:
            findings.append(Finding(url, "undiscovered", "not in the Map result either: nothing links to it"))
        elif len(returned) >= max_pages:
            extra = sum(1 for u in returned if u not in wanted)
            findings.append(Finding(url, "cut_off", f"max_pages={max_pages} was used up, and {extra} of the returned pages are not on your checklist"))
        else:
            findings.append(Finding(url, "not_followed", "Map sees it but the crawl never reached it: raise max_depth or reword crawl_instruction"))
    return findings
```

The order of the checks matters. A returned page is a success or a failure. A skipped URL is excluded, or blocked when the reason is `robots_txt`. Anything else is a page the crawl never touched: it's undiscovered if Map doesn't know it, cut off if the crawl hit `max_pages`, and not followed otherwise.

## Run it on a crawl that missed pages

The last two helpers count the findings and print them, grouped so a long list stays readable:

``` python
def summarize(findings):
    counts = {}
    for item in findings:
        counts[item.label] = counts.get(item.label, 0) + 1
    return counts

def print_findings(findings):
    counts = summarize(findings)
    found = counts.get("returned", 0)
    print(f"{found} of {len(findings)} expected URLs returned")
    for label, count in counts.items():
        if label != "returned":
            print(f"  {label}: {count}")
    groups = {}
    for item in findings:
        if item.label != "returned":
            groups.setdefault((item.label, item.detail), []).append(item.url)
    for (label, detail), urls in groups.items():
        print(f"\n{label}: {detail}")
        for url in urls:
            print("  ", url)
```

Here's the whole check as one script. It starts a crawl, waits, reads the pages and the report, maps the site, and prints the diagnosis:

``` python
# crawl_check.py
import argparse
import os

from spidra import CrawlParams, Spidra

from diagnose import classify, load_expected, normalize, print_findings, read_skipped, wait_for_crawl

ap = argparse.ArgumentParser()
ap.add_argument("--start", default="https://spidra.io/blog")
ap.add_argument("--instruction", required=True)
ap.add_argument("--max-pages", type=int, default=10)
ap.add_argument("--exclude", nargs="*")
args = ap.parse_args()

client = Spidra(api_key=os.environ["SPIDRA_API_KEY"])
expected = load_expected("expected_urls.txt")

params = CrawlParams(base_url=args.start, crawl_instruction=args.instruction,
                     max_pages=args.max_pages, exclude_paths=args.exclude)
job_id = client.start_crawl(params).job_id
job = wait_for_crawl(client, job_id)
if job.status != "completed":
    raise SystemExit(f"crawl {job.status}: {getattr(job, 'error', None)}")

pages = client.crawl_all_pages(job_id)
report, skipped = read_skipped(client, job_id)
mapped = [link.url for link in client.map(args.start, limit=500).links]

print("returned", len(pages), "pages | skipped", report.skipped_total, "links")
if report.understood_as:
    print("understood as:", report.understood_as)
print("navigation pages:", report.navigation_pages)
for item in report.skipped:
    print(" ", item.reason.ljust(20), item.count)
print()
print_findings(classify(expected, mapped, pages, skipped, args.max_pages))
```

Run it with the instruction `All pages` and a limit of ten pages:

```
python crawl_check.py --instruction "All pages" --max-pages 10
```

Output:

```
returned 10 pages | skipped 20 links
navigation pages: 0
  outside_start_path   20

3 of 10 expected URLs returned
  cut_off: 7

cut_off: max_pages=10 was used up, and 7 of the returned pages are not on your checklist
   https://spidra.io/blog/spidra-crawl-api-guide
   https://spidra.io/blog/spidra-batch-scraping-api
   https://spidra.io/blog/spidra-browser-actions-guide
   https://spidra.io/blog/spidra-foreach-structured-output-batch-scrape
   https://spidra.io/blog/scrape-structured-data
   https://spidra.io/blog/authenticated-scraping-and-crawling
   https://spidra.io/blog/captcha-solving-stealth-mode-crawling
```

Ten pages came back, but only three of them were posts. The crawl had a page limit of ten, and it spent seven of those pages on the blog index and the six category pages (Trends, Announcements, Guides, Best Practices, Case Studies and Tutorials), because `All pages` means every page in that part of the site. Seven posts were cut off. The report lists no skipped post: the crawl stopped at its page limit before it reached them.

The 20 `outside_start_path` links are pages like `/pricing` and `/about`. By default a crawl stays under the URL it started from, so a crawl of `/blog` doesn't wander into the rest of the site. That's correct here. If the pages you wanted were outside `/blog`, this row is where you'd see it, and the fix is `crawl_entire_domain=True` plus `include_paths`.

## The instruction is a hint, not a filter

A crawl instruction describes the pages you want. The crawl follows links it judges likely to lead to them, and it returns the pages that match. That makes it good at "individual blog posts" and unreliable as a boundary. For a hard boundary, use `include_paths`, `exclude_paths`, `max_depth` and `max_pages`.

Naming the kind of page is the first fix to try. Run the same crawl with `Individual blog posts`:

```
python crawl_check.py --instruction "Individual blog posts" --max-pages 10
```

Output:

```
returned 10 pages | skipped 55 links
understood as: Individual blog post articles.
navigation pages: 1
  outside_domain       32
  not_relevant         23

10 of 10 expected URLs returned
```

All ten posts came back. `understood_as` confirms how the instruction was read, the blog index was read as a navigation page and not returned, and the 23 `not_relevant` links are links that didn't match the instruction.

The second fix is a path filter. It needs no AI to decide what matches, so it's predictable:

```
python crawl_check.py --instruction "All pages" --max-pages 10 --exclude "/blog/category/*"
```

Output:

```
returned 10 pages | skipped 6 links
navigation pages: 0
  exclude_pattern      6

9 of 10 expected URLs returned
  cut_off: 1

cut_off: max_pages=10 was used up, and 1 of the returned pages are not on your checklist
   https://spidra.io/blog/captcha-solving-stealth-mode-crawling
```

The six category pages are now `exclude_pattern`, which is what you asked for. But nine of ten posts came back, and the diagnosis says why: `All pages` still returns the blog index, and it takes one of the ten slots. Raising `max_pages` to 11 fixes that.

Path patterns match anywhere in a URL's path, so `/books/*` also matches `/catalogue/category/books/…`. Check the `exclude_pattern` and `include_pattern` rows of the report when a filter removes more than you intended.

| You see | Use | Why | 
|---|---|---|
| Pages of the wrong kind in the output | A more specific `crawl_instruction` | It names the page type, and `understood_as` shows how it was read | 
| A section you never want | `exclude_paths` | A hard rule, no AI involved | 
| Expected pages in another part of the site | `crawl_entire_domain` with`include_paths` | Lets the crawl leave its start path, with a fence | 
| Pages cut off at the limit | A higher `max_pages` | Navigation pages don't count, returned pages do | 

## Blocked and failed pages

Two rows in the table need a different fix: the crawl saw the page but it can't be read.

**Blocked.** `respect_robots` is off by default. When you turn it on, pages the site's `robots.txt` disallows are skipped with the reason `robots_txt`, and `classify` reports them as blocked. That's the site's rule, so the fix is to leave the page out. If `robots.txt` disallows the start URL itself, the crawl fails with a message saying so. A start page that can't be read at all also fails the crawl with a reason and a hint, such as turning on [Stealth Mode](https://docs.spidra.io/options/proxies-and-captchas) (`use_proxy=True`), and a failed crawl costs nothing.

**Failed.** A page can come back with `status: "failed"` and an `error_message`. `classify` keeps the message, so you see the reason next to the URL. Failed pages aren't charged. `retry_crawl_page` is not the fix here: it re-runs the extraction on a page that was fetched, and doesn't fetch it again. To get a failed page, scrape that one URL on its own, with Stealth Mode if the site blocks bots.

The tests check the labels. This one builds a checklist with one URL in each of five states (plus a returned one) and checks `classify` puts each where it belongs. A second test covers cut-off:

``` python
def page(url, status="success", error=None):
    return NS(url=url, status=status, error_message=error)

def labels(expected, mapped, pages, skipped, max_pages=10):
    return {f.url: f.label for f in classify([normalize(u) for u in expected], mapped, pages, skipped, max_pages)}

def test_every_bucket():
    skipped = {normalize(B): "exclude_pattern", normalize(C): "robots_txt"}
    pages = [page(A), page(D, "failed", "timed out")]
    result = labels([A, B, C, D, E, F], mapped=[A, B, C, D, F], pages=pages, skipped=skipped)
    assert result == {A: "returned", B: "excluded", C: "blocked", D: "failed", E: "undiscovered", F: "not_followed"}
```

Run the whole suite:

```
python -m pytest -q test_diagnose.py
```

Output:

```
.......                                                                  [100%]
7 passed in 1.75s
```

## What this doesn't cover

- **Pages behind a login.** A crawl only sees what a visitor sees. Pass your own session with`cookies` to crawl pages that need one.
- **Links that exist only in scripts.** Map and the crawl report what the page and sitemap expose. A URL a site builds on click may never appear.
- **A list you can't write.** The checklist is yours to maintain. If you have no list, start with Map and crawl what you find.
- **Skipped URLs past the first 2,000.** The report keeps up to 2,000 per crawl; the counts by reason are always complete.

## Conclusion

"Why did my crawler miss pages?" now has an answer you can check: a URL list, a Map baseline and a crawl report, joined into one table with the setting to change for each missing page.

Most of that debugging is done by the crawler itself. Spidra's crawl report names how it understood your instruction, counts the pages it read only to navigate (and doesn't charge for them), and lists every link it declined with a reason you can filter by. You describe the pages you want in plain language, and you keep hard fences (`include_paths`, `exclude_paths`, `max_depth`, `max_pages`) for the cases where plain language isn't enough. Map gives you the baseline in one call. Failed pages and failed crawls aren't charged, every plan has every feature, and the free plan includes 300 credits with no card, so you can run this on your own site before paying anything.

[Create a free Spidra account](https://spidra.io/), put your own URLs in `expected_urls.txt`, and run `crawl_check.py` against your site. If a page is missing, the output says which row it's in.
