Skip to content

stellar contract extend panics with "index out of bounds" when the extension is a no-op #2599

Description

@leighmcculloch

What version are you using?

soroban-cli 26.1.0 (installed via Homebrew). The offending code is also present on main.

What did you do?

Ran stellar contract extend against a well-formed but non-existent contract ID. The transaction goes through as a no-op, then the CLI panics:

$ stellar contract extend --id CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4 --ledgers-to-extend 1
ℹ️ Simulating transaction…
ℹ️ Signing transaction: decde71f91ef2ce9d89a56fb2d9d4a2725b6034e6efc853a73e924d5d7130313
🌎 Sending transaction…
✅ Transaction submitted successfully!
🔗 https://stellar.expert/explorer/testnet/tx/decde71f91ef2ce9d89a56fb2d9d4a2725b6034e6efc853a73e924d5d7130313
ℹ️ No changes detected, transaction was a no-op.

thread 'main' (12110178) panicked at /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-1949cf8c6b5b557f/soroban-cli-26.1.0/src/commands/contract/extend.rs:288:42:
index out of bounds: the len is 0 but the index is 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
❌

The same crash occurs when attempting to extend any entry that doesn't exist.

What did you expect to see?

A clean error or message indicating the entry does not exist / nothing was extended, with a non-panic exit.

What did you see instead?

The CLI panicked with index out of bounds: the len is 0 but the index is 0 at src/commands/contract/extend.rs:288:42 and exited with a failure code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions