{"record":{"id":"ed1c43be70bf312e","repo":"affaan-m/ECC","slug":"a-confirmed-nonempty-coordinate-is-required","errorCode":null,"errorMessage":"a confirmed nonempty coordinate is required","messagePattern":"a confirmed nonempty coordinate is required","errorType":"validation","errorClass":"ClaimError","httpStatus":null,"severity":"error","filePath":"skills/operator-approval-loop/references/approval_claims.py","lineNumber":131,"sourceCode":"        db.execute(\"UPDATE obligation_delivery_claims SET state='cancelled',updated_ts=? WHERE token=?\",\n                   (now, token))\n\n\ndef mark_unknown(db, token, *, now):\n    \"\"\"Record uncertainty, including a restarted worker's dispatching claim.\"\"\"\n    with _transaction(db, now):\n        row = _claim_row(db, token)\n        if row['state'] == 'unknown':\n            return\n        if row['state'] != 'dispatching':\n            raise ClaimError('only a dispatched attempt can become unknown')\n        db.execute(\"UPDATE obligation_delivery_claims SET state='unknown',updated_ts=? WHERE token=?\",\n                   (now, token))\n\n\ndef _finish(db, token, coordinate, now, evidence):\n    if not isinstance(coordinate, str) or not coordinate.strip():\n        raise ClaimError('a confirmed nonempty coordinate is required')\n    with _transaction(db, now):\n        row = _claim_row(db, token)\n        receipt = db.execute('''SELECT * FROM obligation_deliveries\n            WHERE obligation_id=? AND decision_id=?''',\n                             (row['obligation_id'], row['decision_id'])).fetchone()\n        if row['state'] == 'delivered':\n            if receipt is None or receipt['coordinate'] != coordinate or receipt['kind'] != 'draft_sent':\n                raise ClaimError('completion contradicts the existing receipt')\n            return False\n        expected_state = 'dispatching' if evidence is None else 'unknown'\n        if row['state'] != expected_state:\n            raise ClaimError('completion requires the correct dispatch/reconciliation state')\n        _snapshot(db, row['obligation_id'], row['decision_id'])\n        db.execute('''INSERT INTO obligation_deliveries\n            (obligation_id,decision_id,kind,coordinate,delivered_ts) VALUES (?,?,'draft_sent',?,?)''',\n                   (row['obligation_id'], row['decision_id'], coordinate, now))\n        db.execute('''UPDATE obligation_delivery_claims\n            SET state='delivered',updated_ts=?,reconciliation_evidence=? WHERE token=?''',","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/operator-approval-loop/references/approval_claims.py#L113-L149","documentation":"_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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the actual confirmed delivery coordinate as a nonempty string (e.g. the sent message/draft identifier).","Validate before calling: assert isinstance(coordinate, str) and coordinate.strip().","Convert identifiers to str explicitly (str(obj_id)) and trim/normalize whitespace before the call.","If the coordinate is genuinely unavailable, do not call complete/reconcile — the delivery is not confirmed yet; use mark_unknown instead."],"exampleFix":"// before\nclaims.complete(db, token, message.id, now=ts)  # int -> ClaimError\n\n// after\ncoordinate = str(message.id).strip()\nif not coordinate:\n    raise ValueError(\"delivery coordinate missing\")\nclaims.complete(db, token, coordinate, now=ts)","handlingStrategy":"validation","validationCode":"def validate_coordinate(coordinate):\n    return isinstance(coordinate, str) and bool(coordinate.strip())\n\nif not validate_coordinate(coordinate):\n    raise ValueError(\"coordinate must be a nonempty string before completing\")","typeGuard":"def is_nonempty_str(value):\n    return isinstance(value, str) and value.strip() != \"\"","tryCatchPattern":"try:\n    claims.complete(db, token, coordinate, now=ts)\nexcept claims.ClaimError:\n    log.error(\"completion refused: coordinate missing or invalid\")","preventionTips":["Normalize and trim the coordinate at its source","Coerce identifiers to str before completing","Never call complete/reconcile when the delivery coordinate is not yet confirmed"],"tags":["validation","argument-error","required-field"],"backgroundTag":"empty-required-field","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}