{"record":{"id":"5e6537906236bb9f","repo":"windmill-labs/windmill","slug":"artifact-store-unavailable","errorCode":null,"errorMessage":"Artifact store unavailable","messagePattern":"Artifact store unavailable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/copilot/chat/artifacts/artifactsDB.ts","lineNumber":332,"sourceCode":"\t\tconst items = await db.getAllFromIndex('versions', 'by-artifact', artifactId)\n\t\treturn items.sort((a, b) => b.version - a.version)\n\t} catch (err) {\n\t\tconsole.error('Could not read artifact versions', err)\n\t\treturn []\n\t}\n}\n\n/** A stored snapshot, or undefined when there is none. Rejects when the read could not be made\n * at all — unlike the other reads here, which degrade to undefined. A caller that conflates the\n * two reports a transient failure as permanent absence, and whatever it discards in response\n * (a reader's pinned version) is discarded for good. */\nexport async function getArtifactVersion(\n\tartifactId: string,\n\tversion: number\n): Promise<ArtifactVersion | undefined> {\n\tconst db = await getDB()\n\tif (!db) throw new Error('Artifact store unavailable')\n\ttry {\n\t\treturn await db.get('versions', versionKey(artifactId, version))\n\t} catch (err) {\n\t\tconsole.error('Could not read artifact version', err)\n\t\tthrow err\n\t}\n}\n\nexport async function deleteArtifact(id: string): Promise<void> {\n\tconst db = await getDB()\n\tif (!db) return\n\ttry {\n\t\tconst tx = db.transaction(['items', 'versions'], 'readwrite')\n\t\tawait tx.objectStore('items').delete(id)\n\t\tawait deleteVersionsIn(tx.objectStore('versions'), id)\n\t\tawait tx.done\n\t} catch (err) {\n\t\tconsole.error('Could not delete artifact', err)\n\t}","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/copilot/chat/artifacts/artifactsDB.ts#L314-L350","documentation":"getArtifactVersion reads a specific artifact version from the IndexedDB-backed artifact store (versions store). If getDB() returns no database handle (IndexedDB unavailable or the DB failed to open), the store cannot serve reads and this error is thrown. The underlying read errors are logged and rethrown as well.","triggerScenarios":"Opening the copilot chat in a browser context where IndexedDB is blocked or unavailable (private mode restrictions, storage permission denied, DB open failure), then calling getVersion/getArtifactVersion for an artifact version.","commonSituations":"Safari/Chrome private browsing with storage restrictions; corrupted IndexedDB after a browser upgrade; security settings or extensions blocking third-party storage; running in an environment without IndexedDB support.","solutions":["Close and reopen the chat/browser so getDB() can reopen (or re-create) the artifact database","Clear the site's storage/IndexedDB data to recover from a corrupted DB, then retry","Check that the browser context allows IndexedDB (not blocking private mode / third-party storage policies)","Inspect the console for 'Could not read artifact version' to see the underlying IndexedDB error before this throw"],"exampleFix":"// before\nconst version = await artifactsState.getVersion(artifactId, 1) // throws if no DB\n// after\nlet version\ntry { version = await artifactsState.getVersion(artifactId, 1) }\ncatch { version = undefined /* degrade to in-memory state */ }","handlingStrategy":"try-catch","validationCode":"const db = await getDB()\nif (!db) throw new Error('Artifact store unavailable before read')\nif (!('indexedDB' in globalThis)) throw new Error('IndexedDB not supported in this context')","typeGuard":"function isArtifactVersion(v: unknown): v is ArtifactVersion {\n  return !!v && typeof v === 'object' && 'artifactId' in v && 'version' in v\n}","tryCatchPattern":"let version: ArtifactVersion | undefined\ntry {\n  version = await getArtifactVersion(artifactId, n)\n} catch (err) {\n  console.warn('Artifact store unavailable, falling back to in-memory state', err)\n  version = inMemoryVersions.get(versionKey(artifactId, n))\n}","preventionTips":["Avoid opening chat in storage-blocked contexts (some private modes)","Handle getDB() returning null at startup and surface a storage warning early","Monitor IndexedDB open errors and offer a 'clear site data' recovery path"],"tags":["indexeddb","storage","browser"],"backgroundTag":"storage-unavailable","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}