linshenkx/prompt-optimizer · error · Error

${label} resource validation failed: ${formatImageResourceRe

Error message

${label} resource validation failed: ${formatImageResourceRestoreProblemDetails(report)}

What it means

Thrown by assertImageResourceRestoreReportSafe when a restore-validation report for image resources contains problems. After restoring a backup, the library validates that referenced image resources are intact; if any resource is missing, corrupt, or unresolvable the report is non-empty and this error is raised with a formatted list of problem details.

Source

Thrown at packages/ui/src/utils/image-resource-backup.ts:239

export const formatImageResourceRestoreProblemDetails = <Problem>(
  report: ImageResourceRestoreReport<Problem>,
): string =>
  [
    report.missing.length ? `missing=${report.missing.length}` : '',
    report.corrupt.length ? `corrupt=${report.corrupt.length}` : '',
    report.errors.length ? `errors=${report.errors.length}` : '',
  ].filter(Boolean).join(', ')

export const assertImageResourceRestoreReportSafe = <Problem>(
  report: ImageResourceRestoreReport<Problem>,
  label: string,
): void => {
  if (!hasImageResourceRestoreProblems(report)) {
    return
  }

  throw new Error(`${label} resource validation failed: ${formatImageResourceRestoreProblemDetails(report)}`)
}

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Read the formatted problem details in the message to identify which resources failed and why
  2. Re-run or complete the backup upload so all referenced image resources exist in the remote store
  3. Restore from an earlier known-good backup snapshot
  4. If resources were intentionally deleted, prune dangling references from the backup index before validating
Defensive patterns

Strategy: validation

Validate before calling

import { hasImageResourceRestoreProblems } from '<package>/utils/image-resource-backup'

if (hasImageResourceRestoreProblems(report)) {
  // inspect report problems before asserting; log, alert, or abort restore
  console.warn('restore problems', report)
}

Try / catch

try {
  assertImageResourceRestoreReportSafe(report, 'backup restore')
} catch (error) {
  // message contains per-resource problem details; surface to user and keep previous data
  reportRestoreFailure((error as Error).message)
}

Prevention

When it happens

Trigger: Restoring a remote/local backup where referenced image blobs were not restored, have mismatched hashes or sizes, or reference manifests point to absent resources; partial backup uploads or interrupted restores producing incomplete resource sets.

Common situations: Backup taken while images were being written (torn snapshot); interrupted upload leaving some image objects missing in Drive/S3; restore performed against a different account or bucket lacking referenced objects; schema/version drift between backup versions.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/17d2cb24225c7570. Report an issue: GitHub.