{"record":{"id":"3a848f8169a8ba81","repo":"Eugeny/tabby","slug":"not-found-3a848f","errorCode":null,"errorMessage":"Not found","messagePattern":"Not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"tabby-core/src/services/vault.service.ts","lineNumber":330,"sourceCode":"        const id = (await wrapPromise(this.zone, promisify(crypto.randomBytes)(32))).toString('hex')\n        await this.vault.addSecret({\n            type: VAULT_SECRET_TYPE_FILE,\n            key: {\n                id,\n                description: `${description} (${transfer.getName()})`,\n            },\n            value: Buffer.from(await transfer.readAll()).toString('base64'),\n        })\n        return `${this.prefix}${id}`\n    }\n\n    async retrieveFile (key: string): Promise<Buffer> {\n        if (!key.startsWith(this.prefix)) {\n            throw new Error('Incorrect type')\n        }\n        const secret = await this.vault.getSecret(VAULT_SECRET_TYPE_FILE, { id: key.substring(this.prefix.length) })\n        if (!secret) {\n            throw new Error('Not found')\n        }\n        return Buffer.from(secret.value, 'base64')\n    }\n}\n","sourceCodeStart":312,"sourceCodeEnd":335,"githubUrl":"https://github.com/Eugeny/tabby/blob/14e2d60b9b6dee84a53c37f05eefeb803787de04/tabby-core/src/services/vault.service.ts#L312-L335","documentation":"Thrown by VaultFileProvider.retrieveFile when the requested key has the correct `vault:` prefix and the id parses, but `vault.getSecret(VAULT_SECRET_TYPE_FILE, { id })` returns null - i.e. no stored file secret matches that id. The file was never stored, was deleted, or belongs to a different vault.","triggerScenarios":"Calling `retrieveFile('vault:<id>')` where `<id>` does not match any VaultFileSecret in the current vault's secrets list. Reachable after the secret was removed via updateSecret/deleteSecret, after re-creating the vault with a fresh passphrase, or when a key from another machine's vault is used.","commonSituations":"A profile references a private key stored in the vault that the user later deleted; vault was reset (new passphrase) wiping old secrets; config-sync imported a key id that exists only in the source machine's vault.","solutions":["Re-import the file into the vault via `selectAndStoreFile` to get a fresh key and update the referencing profile.","Confirm the vault currently in use matches the one that originally stored the file (same passphrase/store); if the vault was reset, old ids are invalid.","List current file secrets (`vault.secrets.filter(s => s.type === 'file')`) and verify the id before attempting retrieval.","Catch the error in the caller and prompt the user to re-select the file rather than crashing the operation."],"exampleFix":"// before\nconst secret = await this.vault.getSecret(VAULT_SECRET_TYPE_FILE, { id: key.substring(this.prefix.length) })\nif (!secret) throw new Error('Not found')\n\n// after - diagnose missing vs mismatched id\nconst id = key.substring(this.prefix.length)\nconst secret = await this.vault.getSecret(VAULT_SECRET_TYPE_FILE, { id })\nif (!secret) {\n    const all = (await this.vault.load())?.secrets.filter(s => s.type === VAULT_SECRET_TYPE_FILE) ?? []\n    throw new Error(`Not found: file id ${id}. Known ids: ${all.map(s => (s.key as any).id).join(', ') || '(none)'}`)\n}","handlingStrategy":"validation","validationCode":"async function vaultHasFile (vault: VaultService, id: string): Promise<boolean> {\n    const v = await vault.load()\n    if (!v) return false\n    return v.secrets.some(s => s.type === 'file' && (s.key as any).id === id)\n}\n\nconst id = key.substring('vault:'.length)\nif (!await vaultHasFile(vault, id)) {\n    throw new Error(`Vault has no file with id ${id}; re-import the file`)\n}","typeGuard":"function isVaultFileSecret (s: VaultSecret): s is VaultFileSecret {\n    return s.type === 'file' && typeof (s.key as any)?.id === 'string'\n}","tryCatchPattern":"try {\n    return await provider.retrieveFile(key)\n} catch (e) {\n    if (e instanceof Error && e.message === 'Not found') {\n        // prompt re-import and update the referencing profile\n        return null\n    }\n    throw e\n}","preventionTips":["Store a human-readable description with each file secret so missing ones are easy to identify.","Validate stored file ids against the vault when a profile is loaded.","Re-import files after a vault reset and update profile references.","Avoid sharing vault file ids across machines via config-sync (they are vault-local)."],"tags":["vault","file-providers","retrieval","missing-data","configuration"],"backgroundTag":null,"analyzedSha":"14e2d60b9b6dee84a53c37f05eefeb803787de04","analyzedAt":"2026-08-12T11:46:48.773Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}