error-recovery

Diagnose and recover from CKAN API failures when querying Montréal open data endpoints.

1|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/alistaircroll/montreal-open-data --skill error-recovery-alistaircroll
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-recovery
Source: https://github.com/alistaircroll/montreal-open-data/tree/main/skills/meta/error-recovery
Command: npx skills add https://github.com/alistaircroll/montreal-open-data --skill error-recovery-alistaircroll

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? API calls to Montréal's open data portal fail in predictable but confusing ways: changed resource UUIDs, case-sensitive field names, inconsistent borough spellings, silent row truncation, and rate limits. This Skill provides a decision tree and concrete recovery patterns so an agent can fix the query instead of giving up. ## Core Features & Use Cases - Error Decision Tree: Maps HTTP status codes (404, 400, 403, 409, 500, timeouts) and empty-result cases to specific diagnostic and recovery steps. - Eight Recovery Patterns: Covers stale resource IDs, field name mismatches, borough name variations, 32,000-row pagination limits, text-typed numeric fields, rate limiting, non-CKAN endpoints (BIXI GBFS, STM GTFS, Planif-Neige SOAP), and French character encoding issues. - Use Case: A SQL query against the 311 dataset returns a 409 Conflict. The Skill directs the agent to narrow the date range before GROUP BY, add a LIMIT, or fall back to the datastore_search filter API. ## Quick Start When a Montréal open data query fails or returns empty results, apply the error-recovery decision tree to diagnose the cause and retry with the corrected query.

Frequently Asked Questions about error-recovery

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a 404 error when querying a CKAN resource?

A 404 usually means the resource UUID changed. Call package_show with the dataset slug to list current resource IDs, or run catalog-refresh.py to regenerate the local endpoint registry with up-to-date UUIDs.

Why does my DataStore SQL query return empty results?

Empty results usually come from case-sensitive field names, inconsistent borough name formats, or mismatched date formats. Inspect actual field names with datastore_search limit=0 and use LIKE patterns with wildcards instead of exact matches.

How do I handle CKAN API rate limits and 403 errors?

Wait 10-30 seconds and retry, add LIMIT to every query, and space sequential calls 2-3 seconds apart. For simple queries on large datasets, use the datastore_search filters parameter instead of SQL, which is less likely to be throttled.

Why does my query only return 32000 rows from the DataStore?

The DataStore API silently truncates responses at a 32,000-row default limit. Paginate with LIMIT and OFFSET ordered by _id until fewer rows than the limit are returned, or use GROUP BY to aggregate server-side.

What causes a 409 Conflict error on large CKAN datasets?

A 409 means the SQL query is too complex for server-side processing, common with GROUP BY on multi-million-row datasets like 311 or crime data. Narrow the date range first, then aggregate, or fall back to the filter-based datastore_search endpoint.

How do I handle French character encoding issues in Montréal data?

Most data is UTF-8, but garbled characters indicate Latin-1 decoding. For CSV downloads use encoding utf-8-sig to handle BOM, and accented characters work directly in SQL WHERE clauses.