Skip to content

contract asset deploy on an existing asset contract fails like any other error #2875

Open

Description

@oceans404

What's wrong:
Running stellar contract asset deploy for an asset whose contract is already deployed fails the same way as any other simulation failure. With CLI 28.1.0 on testnet:

$ stellar contract asset deploy --asset native --source alice --network testnet
❌ error: transaction simulation failed: HostError: Error(Storage, ExistingValue)

Event log (newest first):
   0: [Diagnostic Event] topics:[error, Error(Storage, ExistingValue)], data:["contract already exists", Bytes(d7928b72...)]
$ echo $?
1

The command goes straight to simulation (v28.1.0 deploy/asset.rs#L189) with no handling for this case. The only sign that the contract already exists is a host diagnostic on stderr, so a script can't tell "already deployed" apart from a real failure (wrong network, unfunded source, bad asset) without parsing stderr.

For comparison, other setup commands in the CLI already treat "it's already there" as success: contract upload can skip a wasm that's already installed (v28.1.0 upload.rs#L293), and keys fund on a funded account succeeds (#1508).

Impact:
Setup scripts that deploy a token's asset contract can't be re-run cleanly, so they swallow every failure of this command with || true, which also hides real errors.

How we found it:
Found in the HackMeridian 2026 tooling research (147 public hackathon repos, read at their last commit before the deadline), then reproduced with the 28.1.0 release binary on testnet on 1 November 2026, for --asset native and for a credit asset. Three repos wrap this command in || true:

Nothing in the file's history handles the existing-contract case, so it doesn't look like a deliberate choice.

Outcome we're after:
A script that runs contract asset deploy can tell "the asset contract already exists" apart from a real failure, without parsing diagnostic output. How to get there is up to the implementer.

Compatibility: Scripts may rely on today's non-zero exit for an existing contract, so if the observable result of that case changes, it's worth calling out in the release notes.

How to check:

  • Running stellar contract asset deploy --asset native on testnet twice: the second run's result can be told apart from a real failure without parsing stderr.
  • A real failure (for example an unfunded source account) still fails as it does today.

Related: #2622 (structured output and error codes).

Activity

  1. moved this to Backlog (Not Ready) in DevXon Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Backlog (Not Ready)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions