libnyanpasu/clash-nyanpasu · error · Error

result.error

Error message

result.error

What it means

kvStorageDebug.getAll wraps the Tauri command getAllStorageItems; when the backend replies with status 'error', the raw error string from the IPC result is thrown as a plain Error. It surfaces backend storage-read failures to the frontend caller.

Source

Thrown at frontend/interface/src/hooks/use-kv-storage.ts:199

      }
    },
    [key],
  )

  return [value, setValue, { isLoading }] as const
}

/**
 * Debug utilities for the backend KV store.
 * Not intended for production use — these bypass per-key subscriptions.
 */
export const kvStorageDebug = {
  /** Returns all stored key-value pairs with values deserialized from JSON. */
  async getAll(): Promise<Record<string, unknown>> {
    const result = await commands.getAllStorageItems()

    if (result.status === 'error') {
      throw new Error(result.error)
    }

    return Object.fromEntries(
      result.data.map(({ key, value }) => {
        try {
          return [key, JSON.parse(value)]
        } catch {
          return [key, value]
        }
      }),
    )
  },

  /** Removes every entry from the backend storage. */
  async clear(): Promise<void> {
    const result = await commands.clearStorage()

    if (result.status === 'error') {

View on GitHub (pinned to f7dbce2997)

Solutions

  1. Inspect the thrown error string to identify the backend storage failure
  2. Check the backend storage file permissions and integrity
  3. Retry after fixing backend state or reinstalling/repairing app data

Example fix

// before
const all = await kvStorageDebug.getAll()
// after
let all
try {
  all = await kvStorageDebug.getAll()
} catch (e) {
  console.error('storage read failed:', e)
  all = {}
}
Defensive patterns

Strategy: try-catch

Validate before calling

// No pre-call check possible; backend result is only known after invocation

Try / catch

try {
  const all = await kvStorageDebug.getAll()
} catch (e) {
  logger.warn('kv getAll failed', e)
  return {}
}

Prevention

When it happens

Trigger: Calling kvStorageDebug.getAll() when the backend getAllStorageItems command returns { status: 'error', error } — e.g. storage file unreadable or backend handler failed.

Common situations: Debug tooling reading KV storage while the app data directory is corrupted/locked, or the backend storage service failed to initialize.

Related errors


AI-assisted analysis of libnyanpasu/clash-nyanpasu@f7dbce2997 (2026-09-08). Data as JSON: /api/errors/64bc8ea9a16180a9. Report an issue: GitHub.