Skip to content

fix!(errors): regroup error codes into unified chunks and fix out-of-range codes#1127

Open
msluszniak wants to merge 4 commits intosoftware-mansion:mainfrom
msluszniak:claude/error-codes-820
Open

fix!(errors): regroup error codes into unified chunks and fix out-of-range codes#1127
msluszniak wants to merge 4 commits intosoftware-mansion:mainfrom
msluszniak:claude/error-codes-820

Conversation

@msluszniak
Copy link
Copy Markdown
Member

@msluszniak msluszniak commented May 7, 2026

Description

Fixes error code grouping issues in scripts/errors.config.ts. Three codes were out of their designated ranges, and section headers lacked range annotations. Both generated artefacts (ErrorCodes.ts, ErrorCodes.h) were updated accordingly.

Error Old code New code Problem
InvalidModelSource 0xff (255) 0x78 (120) Outside the general RNE range 0x60–0x7f
UnexpectedNumInputs 0x61 (97) 0x79 (121) Below the block start (0x65), creating a gap
TokenizerError 0xa7 (167) 0x7a (122) Was in the SpeechToText range; tokenizers are used across LLMs, embeddings and other models

Section headers now document their allocated hex ranges:
0x60–0x7f · 0xa0–0xaf · 0xb0–0xbf · 0x00–0x3f (with 0x00–0x0f, 0x10–0x1f, 0x20–0x2f, 0x30–0x3f sub-sections).

Introduces a breaking change?

  • Yes
  • No

InvalidModelSource, UnexpectedNumInputs, and TokenizerError have new numeric values. Any code comparing error.code against the old raw integers (255 / 97 / 167) must switch to the named enum constants.

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

  1. Run yarn codegen:errors — output should be identical to the committed generated files.
  2. Verify RnExecutorchErrorCode.InvalidModelSource === 120, RnExecutorchErrorCode.UnexpectedNumInputs === 121, RnExecutorchErrorCode.TokenizerError === 122 at runtime.
  3. Confirm TypeScript compilation passes: cd packages/react-native-executorch && tsc --noEmit.
  4. Search codebase for raw numeric comparisons against 255, 97, or 167 — there should be none.

Screenshots

N/A

Related issues

Fixes #820

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

The errors.config.ts file is the single source of truth — the two generated files (ErrorCodes.ts and ErrorCodes.h) are committed artefacts produced by yarn codegen:errors and should not be edited manually.

msluszniak and others added 3 commits March 3, 2026 16:42
Consolidate npm update configuration and change schedule to monthly.
…ange codes

- InvalidModelSource: 0xff → 0x78 (was outside the 0x60-0x7f general range)
- UnexpectedNumInputs: 0x61 → 0x79 (was below the main general block start)
- TokenizerError: moved from before the SpeechToText section into it (code 0xa7 is correct, position was wrong)
- Added range headers (0x60-0x7f, 0xa0-0xaf, 0xb0-0xbf, 0x00-0x3f) to each section
- Regenerated ErrorCodes.ts and ErrorCodes.h via codegen:errors

Closes software-mansion#820

https://claude.ai/code/session_01DL16DfNCQUGDvmKedjsWCZ
@msluszniak msluszniak added the auto-push PR created via Claude routines or other autonomic flow label May 7, 2026
@msluszniak

This comment was marked as resolved.

TokenizerError is not exclusive to Speech-to-Text — tokenizers are used
across LLMs, embeddings, and other models. Reassign from 0xa7 to 0x7a
and move it into the general RNE errors section (0x60-0x7f).

https://claude.ai/code/session_01DL16DfNCQUGDvmKedjsWCZ
@msluszniak

This comment was marked as off-topic.

@msluszniak msluszniak self-assigned this May 7, 2026
@msluszniak msluszniak added the chore PRs that are chores label May 7, 2026
@msluszniak msluszniak requested a review from chmjkb May 8, 2026 13:59
@msluszniak msluszniak changed the title fix(errors): regroup error codes into unified chunks and fix out-of-range codes fix!(errors): regroup error codes into unified chunks and fix out-of-range codes May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-push PR created via Claude routines or other autonomic flow chore PRs that are chores

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sure that error codes are grouped in unified chunks

2 participants