Repository navigation
Description
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:
- ClipPay,
scripts/deploy.sh#L50-L51: "Make sure the SAC exists (no-op error if it's already deployed)". - 4ward,
scripts/setup-testnet.sh#L72-L73. - ZKross,
spp/deployments/scripts/deploy-local.sh#L35.
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 nativeon 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).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog (Not Ready)
Activity