From 91c375bec89a91c9f7204f1f83d573095ff4d7e8 Mon Sep 17 00:00:00 2001 From: Pileks Date: Fri, 27 Feb 2026 16:55:23 +0100 Subject: [PATCH] update claude.md --- CLAUDE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index e8f43c70..5aa085d9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -169,6 +169,9 @@ require!(account.status == Status::Active, MyError::InvalidStatus); require!(signer.key() == account.authority, MyError::Unauthorized); ``` +### Error Enums +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. + ### After Editing Program Code **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.