Skip to content

tails server returns 500 on duplicate upload #133

Description

@SylvainMartel

When ACA-Py(1.6.0) uses the webvh plugin with auto_attest=true on the witness, the tails file for a new revocation registry gets uploaded twice to the server:

ACA-Py core calls upload_tails_file before invoking register_revocation_registry_definition.
The webvh plugin calls upload_tails_file a second time inside _create_revocation_list_after_rev_reg_def, after the witness has attested the RevRegDef.
On the second upload, the server attempts to insert a duplicate row into the database and raises an unhandled IntegrityError, returning HTTP 500.

ACA-Py's upload_tails_file (in anoncreds/revocation/revocation.py) treats any non-success response as a failure and sets upload_success=False, which transitions the revocation list to STATE_FAILED. Subsequent credential issuance then fails with:

Revocation registry or list is in a bad state

To Reproduce

Start a didwebvh-server-py instance with WEBVH_WITNESS=true.
Configure an ACA-Py witness agent with auto_attest: true.
Configure an ACA-Py issuer agent connected to the witness.
Create a credential definition with support_revocation: true.
Observe the tails upload logs on the server : the second PUT /api/tails/hash/{hash} returns 500.
Attempt to issue a revocable credential → fails with "bad state".

Workaround/possible fix

In server/app/routers/tails.py, add a duplicate-check before the database insert:

# Return 409 if file already exists (ACA-Py put_file treats 409 as idempotent success)
if storage.get_tails_file(tails_hash):
    return Response(content=tails_hash, media_type="text/plain", status_code=409)

# Store file in database
storage.create_tails_file(
    tails_hash=tails_hash, file_content_hex=file_content.hex(), file_size=len(file_content)
)
return Response(content=tails_hash, media_type="text/plain", status_code=201)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions