{"record":{"id":"004ae94ff28232ee","repo":"jlcodes99/cockpit-tools","slug":"messages-noitems","errorCode":null,"errorMessage":"messages.noItems","messagePattern":"messages\\.noItems","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/useProviderAccountsPage.ts","lineNumber":411,"sourceCode":"          readBundleMessage((parsed as { message?: unknown }).message) ??\n          readBundleMessage((parsed as { error?: unknown }).error) ??\n          messages.empty,\n      );\n    }\n  }\n\n  const root =\n    parsed && typeof parsed === 'object' && 'data' in parsed\n      ? (parsed as { data?: unknown }).data\n      : parsed;\n\n  if (typeof root === 'string') {\n    return resolveExternalImportBundleItems(root, platformId, messages);\n  }\n\n  if (Array.isArray(root)) {\n    if (root.length === 0) {\n      throw new Error(messages.noItems);\n    }\n    return root;\n  }\n\n  if (!root || typeof root !== 'object') {\n    throw new Error(messages.empty);\n  }\n\n  const provider = (root as { provider?: unknown }).provider;\n  if (typeof provider === 'string' && provider.trim() && provider.trim() !== platformId) {\n    throw new Error(messages.providerMismatch);\n  }\n\n  const items = (root as { items?: unknown }).items;\n  if (Array.isArray(items) && items.length > 0) {\n    return items;\n  }\n","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/hooks/useProviderAccountsPage.ts#L393-L429","documentation":"The parsed bundle unwrapped (through 'data' and any nested string payload) to a top-level JSON array that is empty. An empty items list cannot create any accounts, so messages.noItems is thrown (line 411).","triggerScenarios":"JSON parses fine, root (after envelope unwrap) is an array with length 0.","commonSituations":"Source account list is genuinely empty (nothing exported yet); export filter excluded all accounts; API returned success with an empty data array; deleted-all-accounts export.","solutions":["Export again after confirming the source has at least one account","Remove filters/limits on the export that excluded all items","If you meant to import a single account, use its object (not an empty array) as the bundle"],"exampleFix":"// before\n{\"data\":[]}\n// after\n{\"data\":[{\"refresh_token\":\"rt_a\"}]}","handlingStrategy":"validation","validationCode":"const bundle: unknown = JSON.parse(content);\nconst root = bundle && typeof bundle === 'object' && 'data' in bundle ? (bundle as {data?: unknown}).data : bundle;\nif (Array.isArray(root) && root.length === 0) throw new Error('Export contains no items');","typeGuard":"const isNonEmptyArray = (v: unknown): v is unknown[] =>\n  Array.isArray(v) && v.length > 0;","tryCatchPattern":"try {\n  items = resolveExternalImportBundleItems(content, platformId, messages);\n} catch (e) {\n  if (e instanceof Error && e.message === messages.noItems) {\n    notifyEmptyExport();\n  }\n}","preventionTips":["Confirm the source account list is non-empty before exporting","Remove export filters that can exclude all accounts","Validate the export contains at least one item before importing"],"tags":["import","empty-data","validation"],"backgroundTag":"empty-import-payload","analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}