affaan-m/ECC · error · ValueError

Ambiguous duplicate bundle request

Error message

Ambiguous duplicate bundle request

What it means

Within a bundle, each (modality, request_id) pair must be unique. The library builds a map from these keys while loading manifests and throws this when the same modality+request_id appears more than once, because taste-claim resolution would be ambiguous.

Solutions

  1. Remove or rename the duplicate request entry so each (modality, request_id) is unique within the bundle
  2. If two entries are genuinely different, assign one a distinct request_id and update assets referencing it
  3. If they are true duplicates, delete the redundant copy from the manifest

Example fix

// before (manifests/image.json)
"requests": [{"request_id": "r1", ...}, {"request_id": "r1", ...}]
// after
"requests": [{"request_id": "r1", ...}, {"request_id": "r2", ...}]
Defensive patterns

Strategy: validation

Validate before calling

seen = set()
for m in modality_manifests:
    for r in m["requests"]:
        key = (m["modality"], r["request_id"])
        if key in seen:
            raise ValueError(f"duplicate bundle request {key}")
        seen.add(key)

Try / catch

try:
    validate_assets(assets, bundle_root=root)
except ValueError as e:
    if str(e) == "Ambiguous duplicate bundle request":
        dedupe_manifests(root); retry()
    else:
        raise

Prevention

When it happens

Trigger: A manifest file under manifests/<modality>.json listing two request entries with the same request_id; merging bundle manifests and reintroducing duplicates.

Common situations: Merging two export bundles that share request ids; copy-pasting a manifest entry to create a variant but forgetting to change request_id; provider retries logged under the same id with differing payloads.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

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


def _bundle(value: Any, base: Path, verify: bool) -> tuple[dict[str, Any], dict[tuple[str, str], Any]]:
    from .contract import validate_bundle

    if verify:
        binding = _verify_binding(value, base)
        root = Path(binding['path']).parent
    else:
        root = _path(value, base)
        binding = _fingerprint(root / 'receipt.json')
    validate_bundle(root)
    requests = {}
    for modality in sorted(MODALITIES):
        manifest = _load(root / 'manifests' / f'{modality}.json')
        for request in manifest['requests']:
            key = (modality, _text(request.get('request_id'), 'request_id'))
            if key in requests:
                raise ValueError('Ambiguous duplicate bundle request')
            requests[key] = request
    if binding != _fingerprint(root / 'receipt.json'):
        raise ValueError('Bundle changed during validation')
    return binding, requests


def _taste(asset: dict[str, Any], requests: dict[Any, Any], verify: bool) -> dict[str, Any]:
    if not requests:
        if any(key in asset for key in (*_TASTE_FIELDS, 'request_id')):
            raise ValueError('Taste claims require a validated bundle')
        return {}
    request_id = _text(asset.get('request_id'), 'bundle request_id')
    request = requests.get((asset['modality'], request_id))
    if request is None:
        raise ValueError('Asset request_id/modality does not match the bundle')
    result = dict(request_id=request_id, **{key: request[key] for key in _TASTE_FIELDS})
    if verify:
        if any(asset.get(key) != value for key, value in result.items()):

View on GitHub (pinned to 8321021c54)