Skip to content

Commit 91c375b

Browse files
committed
update claude.md
1 parent 930cdc8 commit 91c375b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ require!(account.status == Status::Active, MyError::InvalidStatus);
169169
require!(signer.key() == account.authority, MyError::Unauthorized);
170170
```
171171

172+
### Error Enums
173+
Always append new error variants to the **end** of `#[error_code]` enums. Anchor assigns error codes based on variant position (index), so inserting in the middle shifts all subsequent codes and breaks indexing/client-side error matching for deployed programs.
174+
172175
### After Editing Program Code
173176
**Always run `./rebuild.sh` after modifying any Rust code under `programs/`.** This rebuilds all programs, regenerates the SDK types, and lints — ensuring tests run against your latest changes.
174177

0 commit comments

Comments
 (0)