# Buggy code
def from_json(cls, json_info):
    from ..util import parse_date

    info = {key: val for key, val in json_info.items() if key in cls.field_names()}
    info["updated"] = parse_date(info.get("updated"))
    info["sources"] = info.get("sources") or []

    json_history = info.get("history") or {}
    cast_history = {}

    for method, method_history in json_history.items():
        cast_history[method] = []
        for json_result in method_history:
            assert isinstance(json_result, dict), (
                'Items in Link["history"][method] must be dicts'
            )
            cast_result = ArchiveResult.from_json(json_result)
            cast_history[method].append(cast_result)

    info["history"] = cast_history
    return cls(**info)


# Traceback (KeyError)
Traceback (most recent call last):
File "/home/USERNAME/.local/bin/archivebox", line 8, in <module>
sys.exit(main())
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/cli/__init__.py", line 126, in main
pwd=pwd or OUTPUT_DIR,
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/cli/__init__.py", line 62, in run_subcommand
module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/cli/archivebox_init.py", line 34, in main
out_dir=pwd or OUTPUT_DIR,
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/util.py", line 108, in typechecked_function
return func(*args, **kwargs)
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/main.py", line 316, in init
for link in load_main_index(out_dir=out_dir, warn=False)
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/util.py", line 108, in typechecked_function
return func(*args, **kwargs)
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/index/__init__.py", line 250, in load_main_index
all_links = list(parse_json_main_index(out_dir))
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/index/json.py", line 52, in parse_json_main_index
yield Link.from_json(link_json)
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/index/schema.py", line 203, in from_json
cast_result = ArchiveResult.from_json(json_result)
File "/home/USERNAME/.local/lib/python3.7/site-packages/archivebox/index/schema.py", line 62, in from_json
info['start_ts'] = parse_date(info['start_ts'])
KeyError: 'start_ts'

# Fixed code
def from_json(cls, json_info, guess=False):
    from ..util import parse_date

    info = {key: val for key, val in json_info.items() if key in cls.field_names()}
    info["updated"] = parse_date(info.get("updated"))
    info["sources"] = info.get("sources") or []

    json_history = info.get("history") or {}
    cast_history = {}

    for method, method_history in json_history.items():
        cast_history[method] = []
        for json_result in method_history:
            assert isinstance(json_result, dict), (
                'Items in Link["history"][method] must be dicts'
            )
            cast_result = ArchiveResult.from_json(json_result, guess)
            cast_history[method].append(cast_result)

    info["history"] = cast_history
    return cls(**info)