affaan-m/ECC · error · ClaimError

a confirmed nonempty coordinate is required

Error message

a confirmed nonempty coordinate is required

What it means

_finish (used by complete and reconcile) raises this ClaimError when the coordinate argument is not a string or is empty/whitespace-only. The coordinate is the confirmed location/reference of the delivered draft and is recorded immutably in obligation_deliveries, so a meaningful nonempty value is mandatory.

Solutions

  1. Pass the actual confirmed delivery coordinate as a nonempty string (e.g. the sent message/draft identifier).
  2. Validate before calling: assert isinstance(coordinate, str) and coordinate.strip().
  3. Convert identifiers to str explicitly (str(obj_id)) and trim/normalize whitespace before the call.
  4. If the coordinate is genuinely unavailable, do not call complete/reconcile — the delivery is not confirmed yet; use mark_unknown instead.

Example fix

// before
claims.complete(db, token, message.id, now=ts)  # int -> ClaimError

// after
coordinate = str(message.id).strip()
if not coordinate:
    raise ValueError("delivery coordinate missing")
claims.complete(db, token, coordinate, now=ts)
Defensive patterns

Strategy: validation

Validate before calling

def validate_coordinate(coordinate):
    return isinstance(coordinate, str) and bool(coordinate.strip())

if not validate_coordinate(coordinate):
    raise ValueError("coordinate must be a nonempty string before completing")

Type guard

def is_nonempty_str(value):
    return isinstance(value, str) and value.strip() != ""

Try / catch

try:
    claims.complete(db, token, coordinate, now=ts)
except claims.ClaimError:
    log.error("completion refused: coordinate missing or invalid")

Prevention

When it happens

Trigger: complete(db, None, now=...), complete(db, "", now=...), complete(db, " ", now=...), or passing a non-str (int, bytes, None) as coordinate; same for reconcile's coordinate argument.

Common situations: A pipeline variable that was supposed to hold the delivery URL/identifier is still None; upstream normalization stripped the coordinate to empty; a caller passes an integer ID where a string coordinate is expected.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at skills/operator-approval-loop/references/approval_claims.py:131

        db.execute("UPDATE obligation_delivery_claims SET state='cancelled',updated_ts=? WHERE token=?",
                   (now, token))


def mark_unknown(db, token, *, now):
    """Record uncertainty, including a restarted worker's dispatching claim."""
    with _transaction(db, now):
        row = _claim_row(db, token)
        if row['state'] == 'unknown':
            return
        if row['state'] != 'dispatching':
            raise ClaimError('only a dispatched attempt can become unknown')
        db.execute("UPDATE obligation_delivery_claims SET state='unknown',updated_ts=? WHERE token=?",
                   (now, token))


def _finish(db, token, coordinate, now, evidence):
    if not isinstance(coordinate, str) or not coordinate.strip():
        raise ClaimError('a confirmed nonempty coordinate is required')
    with _transaction(db, now):
        row = _claim_row(db, token)
        receipt = db.execute('''SELECT * FROM obligation_deliveries
            WHERE obligation_id=? AND decision_id=?''',
                             (row['obligation_id'], row['decision_id'])).fetchone()
        if row['state'] == 'delivered':
            if receipt is None or receipt['coordinate'] != coordinate or receipt['kind'] != 'draft_sent':
                raise ClaimError('completion contradicts the existing receipt')
            return False
        expected_state = 'dispatching' if evidence is None else 'unknown'
        if row['state'] != expected_state:
            raise ClaimError('completion requires the correct dispatch/reconciliation state')
        _snapshot(db, row['obligation_id'], row['decision_id'])
        db.execute('''INSERT INTO obligation_deliveries
            (obligation_id,decision_id,kind,coordinate,delivered_ts) VALUES (?,?,'draft_sent',?,?)''',
                   (row['obligation_id'], row['decision_id'], coordinate, now))
        db.execute('''UPDATE obligation_delivery_claims
            SET state='delivered',updated_ts=?,reconciliation_evidence=? WHERE token=?''',

View on GitHub (pinned to 8321021c54)