Repository navigation
Errors and Edge Cases
Every error and odd answer a run of 0.6.1 (commit 078613e) showed on 2026-11-02, with its exact output.
| Exit | Output | When |
|---|---|---|
| 0 | one JSON object with "ok": true
|
the command did its job; a check can still list warnings
|
| 1 | one JSON object with "ok": false and error or problems
|
a refused input, a failed fetch, or a check that found problems (validate-pack, verify sources) |
| 2 | argparse's usage text on stderr, no JSON | an unknown command, a missing argument or an unknown option |
Exit 2 is the exception to "one JSON object per command": the argument parser stops before hw.py runs.
python hw.py wd claims[stderr] usage: hw.py wd [-h] [--prop PROP] [--lang LANG] [--limit LIMIT] [--scholarly]
{search,claims,entity,sparql} value
hw.py wd: error: the following arguments are required: value
There is no year 0 in BC and AD counting:
python hw.py cal date "0 AD"{
"ok": false,
"error": "historical years start at 1 (there is no year 0 in BC/AD counting)"
}
Roman day counts are read since 0.2.0, with Roman inclusive counting. In 0.1.0 this input was refused with a request for the day of the month, and before 2026-10-18 it failed with "cannot read a year":
python hw.py cal date "Ides of March 44 BC"{
"ok": true,
"input": "Ides of March 44 BC",
"read_as": {
"astronomical_year": -43,
"month": 3,
"day": 15,
"calendar": "julian",
"label": "15 March 44 BC"
},
"precision": "day",
"jdn": [
1705426,
1705426
],
"edtf": "-0043-03-15",
"day": {
"jdn": 1705426,
"weekday": "Wednesday",
"julian": {
"iso": "-0043-03-15",
"label": "15 March 44 BC",
"auc": 710
},
"gregorian": {
"iso": "-0043-03-13",
"label": "13 March 44 BC"
},
"notes": [
"Gregorian reading before 15 October 1582 is proleptic"
]
},
"notes": [
"Roman day count read as 15 March (Ides of March = 15 March, counted inclusively)"
]
}
A Roman day count without its month is still refused, with the forms to use:
python hw.py cal date "Kalends 44 BC"{
"ok": false,
"error": "cannot read 'Kalends 44 BC': write a Roman day count as 'Ides of March 44 BC', 'pridie Kalendas Apriles 44 BC' or 'a.d. III Id. Mar. 44 BC'"
}
Hijri month names are read since 0.2.0, on the tabular calendar. 0.1.0 refused them, and before 2026-10-18 this input came back as the year AD 1 (labelled "1 AD 1") with no warning:
python hw.py cal date "1 Muharram 1 AH"{
"ok": true,
"input": "1 Muharram 1 AH",
"read_as": {
"calendar": "islamic (tabular)",
"ah_year": 1,
"ah_month": 1,
"ah_day": 1,
"label": "1 Muharram AH 1",
"western_start": {
"astronomical_year": 622,
"month": 7,
"day": 16,
"calendar": "julian",
"label": "16 July AD 622"
}
},
"precision": "day",
"jdn": [
1948440,
1948440
],
"edtf": "0622-07-16",
"day": {
"jdn": 1948440,
"weekday": "Friday",
"julian": {
"iso": "0622-07-16",
"label": "16 July AD 622",
"auc": 1375
},
"gregorian": {
"iso": "0622-07-19",
"label": "19 July AD 622"
},
"islamic_tabular": {
"ah": "1-01-01",
"note": "tabular; observed dates can differ by a day or two"
},
"notes": [
"Gregorian reading before 15 October 1582 is proleptic"
]
},
"notes": [
"tabular Islamic calendar (civil epoch); observed dates can differ by a day or two"
]
}
A day a Hijri month cannot have is refused:
python hw.py cal date "45 Ramadan 1445"{
"ok": false,
"error": "cannot read '45 Ramadan 1445': a Hijri month has 29 or 30 days"
}
c., ca., circa and about mark a date as approximate since 0.2.0: the EDTF gets ~ and the output a qualifier. In 0.1.0 "c." was only listed in notes as an ignored word, and the EDTF had no ~.
python hw.py cal date "c. 100 BC"The output begins:
"input": "c. 100 BC",
"read_as": {
"astronomical_year": -99,
"month": null,
"day": null,
"calendar": "julian",
"label": "100 BC"
},
"precision": "year",
"jdn": [
1684899,
1685263
],
"edtf": "-0099~",
and ends with:
"qualifier": "circa",
"notes": [
"written as approximate (circa): EDTF gets ~"
]
Two more:
- Before 2026-10-18,
"709 AUC"and"1300 AH"(the year first) were read as AD 709 and AD 1300 with no warning, and"AH 1300"gave the days of 1882 instead of those of AH 1300. Both were fixed before 0.1.0 (How dates are computed). - In 0.1.0,
read_asfor an AH year showed only the Western year it begins in ("label": "1882"for AH 1300). Since 0.2.0 it reads"label": "AH 1300", with that Western year underwestern_start.jdnandedtfgive the year's real extent.
Since 0.5.0 validate-pack fails on an EDTF interval that ends before it starts, and on a jdn range outside the days its EDTF covers:
python hw.py validate-pack pack-interval{
"ok": false,
"pack": "pack-interval",
"problems": [
"entity Julius Caesar birth: jdn [1685091, 1685092] falls outside the days '1790/1840' covers [2374845, 2393483]",
"timeline row 0: interval '1840/1790' ends before it starts"
],
"warnings": []
}
The pack and the rules are on The research pack.
OCR reads the long s as f, so a quote in modern spelling misses. Since 0.5.0 verify quote tries again with every s inside a word read as f and labels the match normalised, long s read as f (pre-1800 print) (How claims are checked). On the Internet Archive, give the item's download/ITEM/ITEM_djvu.txt URL: the stream/ URL of the same text returned found: false for a quote the download URL matched (2026-11-01).
wd claims, wd entity and verify qid take only a QID, never a name:
python hw.py wd claims Caesar{
"ok": false,
"error": "not a QID: 'Caesar' (discover it with wd search first; never invent one)"
}
- A 401, 403 or 429 is reported as
unknown, never as a missing page. Before 0.1.0 the Wayback Machine's availability API answered 429 to every request at hw.py's half-second pace, so a missing page with no archive came backunknown; 0.1.0 waits 4 seconds per Internet Archive request and got answers (How claims are checked). - Without a contact address, Wikimedia allows 10 requests a minute; with one, 200. hw.py keeps a per-host pace across separate runs (
pace.jsonin the home folder) and waits up to 30 seconds before a request. Set a contact before long sessions (Getting started). - Some servers refuse a User-Agent that names a library. hw.py's agent names the tool, its repository and the contact, and no library.
The Wayback Machine's capture index lists some captures more than once. In 0.1.0, src wayback microsoft.com --limit 3 returned the same 1996 capture three times. Since 0.2.0 the query asks the index to collapse adjacent identical captures (collapse=digest), and the same command returns three different captures from October 1996 (Commands). The query src sends still asks for 10 rows, whatever --limit says; --limit cuts the list afterwards.
Each gazetteer ranks its own results. Pleiades lists Alesiai in Lakonia before Caesar's Alesia in Gaul (Commands), so read every result and its description before taking a coordinate.
Windows consoles default to the cp1252 code page, which cannot print 康熙. hw.py switches its own output to UTF-8. A script of yours that reads hw.py's output, or prints Chinese characters itself, needs PYTHONIOENCODING=utf-8.
Python 3.13 and later reject some archive certificates that curl accepts ("Missing Subject Key Identifier"). On that error only, cal setup retries once with the strict check off (the chain and host name are still checked), then falls back to DILA's copy of the same data on GitHub.
Keys are never printed in full: keys status shows whether each is set and, for a set key, only its last characters. OpenAlex and WHG keys travel in an Authorization header, and any key=, api_key=, wskey= or token= value in a URL is hidden in the fetch log and in src output.
This wiki describes historywright 0.6.1 (released 2026-11-02, commit 078613e) and was last updated on 2026-11-02. The plugin is MIT licensed. Report problems in the issues.
Using it
- Getting started
- The skills
- Commands
- How dates are computed
- How claims are checked
- The research pack
- Errors and edge cases
- Recipes
- FAQ
The releases
Contributing
Elsewhere