affaan-m/ECC · error · ValueError

input_artifacts must be a list

Error message

input_artifacts must be a list

What it means

validate_assets checks that a receipt's input_artifacts field is a JSON list before iterating and verifying binding hashes for each entry. The library throws this when the receipt declares input_artifacts as anything other than an array (string, dict, null, number). It guards the for-loop from TypeError and enforces the receipt schema contract.

Solutions

  1. Edit the receipt so input_artifacts is a JSON array of artifact objects (wrap a single object in []).
  2. If input_artifacts is intentionally empty, set it to [] rather than omitting it or null.
  3. Regenerate the receipt with the matching tasteforge version that produces the expected schema.
  4. Remove stray hand edits / re-export the receipt from source JSON rather than manual patching.

Example fix

// before
"input_artifacts": {"path": "a.png", "sha256": "..."}
// after
"input_artifacts": [{"path": "a.png", "sha256": "..."}]
Defensive patterns

Strategy: validation

Validate before calling

def is_valid_receipt(receipt):
    return isinstance(receipt, dict) and isinstance(receipt.get('input_artifacts'), list)

Type guard

def has_input_artifacts_list(receipt) -> bool:
    return isinstance(receipt, dict) and isinstance(receipt.get('input_artifacts'), list)

Try / catch

try:
    validate_assets(receipt_path)
except ValueError as e:
    if 'input_artifacts must be a list' in str(e):
        receipt['input_artifacts'] = list(receipt.get('input_artifacts') or [])
    else:
        raise

Prevention

When it happens

Trigger: Calling validate_assets on a receipt JSON where 'input_artifacts' is absent (None), a single object instead of a list, a comma-joined string of paths, or otherwise not a JSON array.

Common situations: Hand-edited receipt JSON, scripts that emit a single artifact object when only one input exists, receipts serialized from non-list languages/collections, or receipts generated by older tool versions with a different schema.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/0d6f7066b5165066. Report an issue: GitHub.

Appendix: source

Thrown at skills/taste-application/scripts/tasteforge/assets.py:238

    path = _path(receipt_path, Path.cwd())
    receipt = _load(path)
    if receipt.get('schema') != SCHEMA:
        raise ValueError('Unsupported asset receipt schema')
    if type(receipt.get('provider_calls')) is not int or receipt['provider_calls'] != 0:
        raise ValueError('Local ingestion must have zero provider calls')
    if receipt.get('provider_execution') is not False:
        raise ValueError('Local ingestion cannot claim provider execution')
    _, requests = (_bundle(receipt['bundle_receipt'], path.parent, True)
                   if 'bundle_receipt' in receipt else (None, {}))
    for asset in _assets(receipt.get('assets')):
        _taste(asset, requests, True)
        _verify_binding(asset, path.parent, asset['modality'])
        provenance = _provenance(asset, path.parent, True)
        if provenance is not None and provenance != asset['provider_provenance']:
            raise ValueError('Invalid supplied provenance declaration')
    inputs = receipt.get('input_artifacts')
    if not isinstance(inputs, list):
        raise ValueError('input_artifacts must be a list')
    for artifact in inputs:
        _verify_binding(artifact, path.parent)
    if 'genre_spec' in receipt:
        _verify_binding(receipt['genre_spec'], path.parent)
    return receipt

View on GitHub (pinned to 8321021c54)