Skip to content

fix(sdk): stop sending account names the node refuses to parse - #1407

Merged
feruzm merged 2 commits into
developfrom
bugfix/account-lookup-name-guard
Aug 11, 2026
Merged

fix(sdk): stop sending account names the node refuses to parse#1407
feruzm merged 2 commits into
developfrom
bugfix/account-lookup-name-guard

Conversation

@feruzm

@feruzm feruzm commented Aug 11, 2026

Copy link
Copy Markdown
Member

Fixes #1403

Roughly 20 Sentry groups since May, all of the form RPCError: Assert Exception:in_len <= sizeof(data): Input too large: <value> (17) for fixed size string: (16).

What actually happens

An account name is a fixed_string of 16 bytes. hived asserts on the byte length while deserialising the argument, before it looks anything up, so an over-long value is not answered with "no such account", it is answered with the assert. That applies to plain reads as much as to a broadcast, because lookup_accounts, get_accounts and get_account_reputations all take an account_name_type:

condenser_api.lookup_accounts ["aliveandthriving,", 5]
-> Assert Exception:in_len <= sizeof(data)

The @ trigger in textarea-autocomplete hands lookup_accounts whatever follows the @ up to the next whitespace, with minChar: 2 as the only guard, so prose punctuation rides along. That accounts for the reported values and for the culprit URLs (entry pages for the reply box, /submit and /draft/<uuid> for the editor):

  • @aliveandthriving, -> aliveandthriving,
  • @minismallholding! -> minismallholding!
  • @isaacmartiubeda(64) -> isaacmartiubeda(64), a username pasted along with its rendered reputation badge

It reached Sentry as mechanism: onunhandledrejection, handled: no because the await sits in a setTimeout callback inside a new Promise executor, where nothing catches it.

The check has to count bytes

This is the part a .length <= 16 check gets wrong, and the numbers hived reports are byte counts:

value chars utf8 bytes node reported
aliveandthriving, 17 17 17
sebastián.bilbao 16 17 17
вцпк33ппп43 11 18 18

Changes

  • isQueryableAccountName in the SDK accounts utils, a byte-length gate.
  • lookupAccountsQueryOptions and getAccountReputationsQueryOptions resolve to no matches instead of making the call. For a lookup that is the honest answer, and it is what every caller already handles.
  • getAccountsQueryOptions drops only the offending entries, since one bad name asserts the whole batch. A caller asking "does this account exist" gets the empty result it already handles, and a batch with one good name still returns it.
  • The @ dataProvider resolves to no suggestions when a lookup fails, so nothing can escape as an unhandled rejection.

This is deliberately a length gate and not account-name validation. A prefix search is allowed to ask about something that is not yet a legal name, and the node answers that with no matches. The only thing that must not happen is a request the node refuses to parse.

Worth noting separately: getUsernameError in apps/web/src/utils/username-validation.ts uses username.length > 16, and the referral field on /signup/free is character-length checked with no charset check. Those inputs now reach a guarded query rather than the node, but the messages they show a user could be better. Left alone here.

Verification

  • pnpm --filter @ecency/sdk test — 723 passed (52 files). New account-name-query.spec.ts covers the byte counts of the exact values that reached production and the cases a character check would let through; lookup-accounts-query-options.spec.ts and the additions to get-accounts-query-options.spec.ts assert the node is not called at all for those, and that a mixed batch still queries the good name. Reverting the three query files leaves exactly those four query-level cases red.
  • pnpm --filter @ecency/web test — 2596 passed (271 files).
  • pnpm typecheck — clean. pnpm lint — clean.
  • apps/self-hosted builds and check-node-globals reports 3 chunks clean, since this touches package code. The guard uses TextEncoder, not a Node global.

dist/ is not rebuilt here, that stays label-gated.

Summary by CodeRabbit

  • Bug Fixes
    • Account and path autocomplete now safely returns no suggestions when lookups fail.
    • Invalid, empty, oversized, or unsupported account names are filtered before requests are sent.
    • Mixed account searches continue returning valid results while excluding unqueryable names.
    • Reputation and account-prefix lookups now return empty results instead of triggering failed node requests.
  • SDK
    • Released SDK version 2.3.82 with improved account-query handling.
  • Wallets
    • Released wallets package version 5.0.82 with the updated SDK.

An account name is a fixed_string of 16 bytes, and hived asserts on the byte
length while deserialising the argument, before it looks anything up. So an
over-long value is not "no such account", it is

  Assert Exception:in_len <= sizeof(data): Input too large: `<value>` (17)
    for fixed size string: (16)

and it comes back from plain reads too: lookup_accounts, get_accounts and
get_account_reputations all take an account_name_type.

The editor's `@` autocomplete hands lookup_accounts whatever follows the `@`,
so `@aliveandthriving,` written in prose arrives with its comma attached. That
is the bulk of the reports. It surfaced unhandled because the await sits in a
setTimeout callback inside a Promise executor with nothing catching it.

The guard counts bytes rather than characters, which is where a `.length <= 16`
check misses: `sebastián.bilbao` is 16 characters and 17 bytes, `вцпк33ппп43` is
11 characters and 18 bytes. Both were reported by the node as 17 and 18.

It is a length gate, not name validation. A prefix search may legitimately ask
about something that is not a valid name, and the node answers that with no
matches. get_accounts drops only the offending entries, since one bad name
asserts the whole batch.

The `@` dataProvider now resolves to no suggestions when a lookup fails, so a
failure cannot escape as an unhandled rejection.

Fixes #1403
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4f67623f-f629-46d3-ab4d-07c2d7ef1bf8

📥 Commits

Reviewing files that changed from the base of the PR and between 7db3a7a and d0ffe7e.

⛔ Files ignored due to path filters (7)
  • packages/sdk/dist/browser/index.d.ts is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js is excluded by !**/dist/**
  • packages/sdk/dist/browser/index.js.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.cjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.cjs.map is excluded by !**/dist/**, !**/*.map
  • packages/sdk/dist/node/index.mjs is excluded by !**/dist/**
  • packages/sdk/dist/node/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (13)
  • apps/web/src/features/shared/textarea-autocomplete/index.tsx
  • packages/sdk/CHANGELOG.md
  • packages/sdk/package.json
  • packages/sdk/src/modules/accounts/queries/get-account-reputations-query-options.ts
  • packages/sdk/src/modules/accounts/queries/get-accounts-query-options.spec.ts
  • packages/sdk/src/modules/accounts/queries/get-accounts-query-options.ts
  • packages/sdk/src/modules/accounts/queries/lookup-accounts-query-options.spec.ts
  • packages/sdk/src/modules/accounts/queries/lookup-accounts-query-options.ts
  • packages/sdk/src/modules/accounts/utils/account-name-query.spec.ts
  • packages/sdk/src/modules/accounts/utils/account-name-query.ts
  • packages/sdk/src/modules/accounts/utils/index.ts
  • packages/wallets/CHANGELOG.md
  • packages/wallets/package.json

📝 Walkthrough

Walkthrough

The SDK now rejects empty or over-limit account names before RPC calls, filters invalid names from batches, and adds regression tests. Web autocomplete converts lookup failures into empty results. SDK and wallets versions increase by one patch release.

Changes

Account queryability safeguards

Layer / File(s) Summary
Account queryability contract
packages/sdk/src/modules/accounts/utils/account-name-query.ts, packages/sdk/src/modules/accounts/utils/index.ts, packages/sdk/src/modules/accounts/utils/account-name-query.spec.ts
The SDK measures UTF-8 byte length and rejects empty or over-16-byte account names. Tests cover boundaries, multibyte values, and prefixes.
Validated account queries
packages/sdk/src/modules/accounts/queries/*, packages/sdk/CHANGELOG.md, packages/sdk/package.json, packages/wallets/CHANGELOG.md, packages/wallets/package.json
Account, lookup, and reputation queries avoid invalid RPC inputs. Tests verify filtering, empty results, RPC arguments, and suppressed calls. Package versions and changelogs are updated.
Autocomplete error handling
apps/web/src/features/shared/textarea-autocomplete/index.tsx
Failed path and account lookups now resolve with empty suggestion lists.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

I’m a rabbit guarding names in flight,
Sixteen bytes must fit just right.
Bad paths fade to lists of none,
Good accounts reach the RPC run.
Tests thump softly: hop, hop, done!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/account-lookup-name-guard

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@feruzm feruzm added the patch Bug fixes and patches (1.0.0 → 1.0.1) label Aug 11, 2026
@feruzm
feruzm merged commit 053f58b into develop Aug 11, 2026
3 of 4 checks passed
@feruzm
feruzm deleted the bugfix/account-lookup-name-guard branch August 11, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch Bug fixes and patches (1.0.0 → 1.0.1)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Account lookups send names the node rejects: RPCError in_len <= sizeof(data) (fixed_string 16)

1 participant