{"record":{"id":"49c6df594eaf64fb","repo":"nexu-io/open-design","slug":"brand-backing-project-not-found-projectid","errorCode":null,"errorMessage":"brand backing project not found: ${projectId}","messagePattern":"brand backing project not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/daemon/src/brands/index.ts","lineNumber":694,"sourceCode":"      extractionSettled = true;\n      clearTimeout(stallTimer);\n      clearTimeout(hardCapTimer);\n    });\n  input.onBackgroundExtraction?.(settled);\n\n  return settled;\n}\n\nexport async function continueBrandExtraction(\n  opts: ContinueBrandExtractionOptions,\n): Promise<StartBrandExtractionResult> {\n  const detail = readBrandDetail(opts.brandsRoot, opts.id);\n  if (!detail) throw new Error(`brand not found: ${opts.id}`);\n  const { meta } = detail;\n  const sourceUrl = meta.sourceUrl;\n  const projectId = meta.projectId ?? brandProjectId(opts.id);\n  const project = getProject(opts.db, projectId);\n  if (!project) throw new Error(`brand backing project not found: ${projectId}`);\n\n  const randomId = opts.randomId ?? randomUUID;\n  const locale = normalizeBrandKitLocale(opts.locale ?? meta.locale);\n  const hasWebsiteSource = /^https?:\\/\\//i.test(sourceUrl);\n  const designMd = readDesignMdInput(opts.brandsRoot, opts.id);\n  const hasDesignMdSource = Boolean(designMd) || sourceUrl.startsWith('designmd://');\n  const host = hostnameOf(sourceUrl);\n  const now = Date.now();\n  const extractionAttemptId = newBrandExtractionAttemptId();\n  const conversationId = resolveBrandRetryConversationId({\n    db: opts.db,\n    projectId,\n    preferredConversationId: meta.conversationId ?? null,\n    randomId,\n    now,\n  });\n\n  let nextMeta = patchMeta(opts.brandsRoot, opts.id, {","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/brands/index.ts#L676-L712","documentation":"Thrown by continueBrandExtraction when the brand meta exists but getProject(db, projectId) returns null, meaning the SQLite project row backing the brand is gone. The on-disk brand survived but the project database was reset, dropped, or surgically modified. Indicates a data-integrity split between filesystem and DB.","triggerScenarios":"The SQLite DB was wiped or restored from an older backup while the brands directory was left intact; someone manually deleted the project row; the project DB file was moved.","commonSituations":"Partial data restore (DB restored without the brands dir, or vice versa); manual DB surgery; a migration that dropped project rows but not brands.","solutions":["Restore the project database so the backing project row exists again.","Re-create the backing project and update the brand meta's projectId to match.","If reconciliation is not possible, re-run startBrandExtraction to create a fresh brand + project pair and delete the orphaned brand."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const detail = readBrandDetail(brandsRoot, opts.id);\nif (!detail) throw new NotFoundError(`brand not found: ${opts.id}`);\nconst projectId = detail.meta.projectId ?? brandProjectId(opts.id);\nconst project = getProject(db, projectId);\nif (!project) {\n  throw new DataIntegrityError(`Brand '${opts.id}' has no backing project row '${projectId}'. Re-create the brand or restore the project DB.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await continueBrandExtraction(opts);\n} catch (err) {\n  if (err instanceof Error && /^brand backing project not found:/.test(err.message)) {\n    return conflict('Backing project is gone. Re-run startBrandExtraction to recreate it.');\n  }\n  throw err;\n}","preventionTips":["Back up the SQLite project DB alongside the brands directory so they restore together.","Never delete project rows manually without also removing the brand meta.","After a DB restore, run a reconciliation pass that orphans brands whose project rows are missing."],"tags":["brands","data-integrity","not-found","database"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}