{"record":{"id":"c4819d7b89c29e5b","repo":"jlcodes99/cockpit-tools","slug":"selected-sections-missing","errorCode":"selected_sections_missing","errorMessage":"selected_sections_missing","messagePattern":"selected_sections_missing","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/dataTransferService.ts","lineNumber":1360,"sourceCode":"      if (parsed.accounts) {\n        accountResult = await importAllAccountsFromTransferJson(JSON.stringify(parsed.accounts), {\n          onProgress: options.onAccountProgress,\n        });\n      } else {\n        warnings.push('accounts_section_missing');\n      }\n    }\n\n    if (options.includeConfig) {\n      if (parsed.config) {\n        configResult = await importConfigBundle(parsed.config);\n      } else {\n        warnings.push('config_section_missing');\n      }\n    }\n\n    if (!accountResult && !configResult) {\n      throw new Error('selected_sections_missing');\n    }\n\n    return {\n      detected_format: 'data_bundle',\n      imported_account_count: accountResult?.imported_count ?? 0,\n      account_result: accountResult,\n      config_result: configResult,\n      warnings,\n    };\n  }\n\n  if (isAccountTransferBundleLike(parsed)) {\n    if (!options.includeAccounts) {\n      throw new Error('accounts_section_required');\n    }\n\n    const accountResult = await importAllAccountsFromTransferJson(jsonContent, {\n      onProgress: options.onAccountProgress,","sourceCodeStart":1342,"sourceCodeEnd":1378,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/services/dataTransferService.ts#L1342-L1378","documentation":"Thrown when a data-transfer bundle is structurally valid and version matches, but neither the accounts nor the config section produced an import result — i.e. the selection asked for sections the bundle does not actually contain, so nothing was imported. Warnings like account/config_section_missing are recorded first, and if both sections end up missing the import fails outright.","triggerScenarios":"Importing a bundle that contains only config while includeAccounts was requested (or vice versa), with the requested section absent from the file; importing a bundle where both sections are null/empty; calling the bundle path with a file that lost its sections during hand-editing.","commonSituations":"Export was made with a narrower selection than the import expects; file was partially edited/truncated; mismatch between what the user believes the export contains and its actual content.","solutions":["Inspect the bundle JSON and confirm which sections (accounts/config) it actually contains.","Re-export with includeAccounts/includeConfig enabled for the sections you need.","Align the import options with the bundle's contents (only request sections present in the file)."],"exampleFix":"// before\nawait importDataTransferJson(json, { includeAccounts: true, includeConfig: true });\n// after\nconst bundle = JSON.parse(json);\nconst hasAccounts = Array.isArray(bundle.accounts);\nconst hasConfig = Boolean(bundle.config);\nif (!hasAccounts && !hasConfig) throw new Error('bundle has no importable sections');\nawait importDataTransferJson(json, { includeAccounts: hasAccounts, includeConfig: hasConfig });","handlingStrategy":"validation","validationCode":"const bundle = JSON.parse(json);\nconst hasAccounts = Array.isArray(bundle?.accounts);\nconst hasConfig = bundle?.config != null;\nif (!hasAccounts && !hasConfig) { alert('This bundle contains neither accounts nor config.'); return; }\nconst options = { includeAccounts: hasAccounts, includeConfig: hasConfig };","typeGuard":"function hasImportableSections(b) {\n  return !!b && (Array.isArray(b.accounts) || b.config != null);\n}","tryCatchPattern":"try {\n  await importDataTransferJson(json, options);\n} catch (e) {\n  if (e.message === 'selected_sections_missing') {\n    console.error('Requested sections are absent from the bundle; inspect warnings and re-export with the needed sections.');\n  } else throw e;\n}","preventionTips":["Inspect bundle contents and align import options to the sections actually present.","Export with all needed sections enabled so imports are not half-empty.","Surface account_section_missing / config_section_missing warnings to users instead of proceeding silently."],"tags":["import","bundle","missing-data"],"backgroundTag":"missing-section","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"}