{"record":{"id":"06ccf4e0eeea5a92","repo":"stablyai/orca","slug":"unsupported-file-pick-a-png-apng-jpg-gif-webp","errorCode":null,"errorMessage":"Unsupported file. Pick a PNG, APNG, JPG, GIF, WebP, or SVG.","messagePattern":"Unsupported file\\. Pick a PNG, APNG, JPG, GIF, WebP, or SVG\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/main/ipc/pet.ts","lineNumber":193,"sourceCode":"      properties: ['openFile'],\n      // Why: omit `apng` — macOS maps dialog extensions to UTIs, and apng's missing UTI can drop siblings like webp (APNG uses .png anyway).\n      filters: [\n        {\n          name: 'Pet image',\n          extensions: ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg']\n        }\n      ]\n    }\n    const result = senderWindow\n      ? await dialog.showOpenDialog(senderWindow, options)\n      : await dialog.showOpenDialog(options)\n    if (result.canceled || result.filePaths.length === 0) {\n      return null\n    }\n    const src = result.filePaths[0]\n    const classified = classifyFile(src)\n    if (!classified) {\n      throw new Error('Unsupported file. Pick a PNG, APNG, JPG, GIF, WebP, or SVG.')\n    }\n    let srcStat: Awaited<ReturnType<typeof stat>>\n    try {\n      srcStat = await stat(src)\n    } catch {\n      throw new Error('Could not read the selected file.')\n    }\n    if (!srcStat.isFile()) {\n      throw new Error('Selected path is not a file')\n    }\n    if (srcStat.size > MAX_BYTES) {\n      throw new Error(\n        `File is too large (${(srcStat.size / (1024 * 1024)).toFixed(1)} MB). Max is ${MAX_BYTES / (1024 * 1024)} MB.`\n      )\n    }\n\n    const dir = getPetsDir()\n    await mkdir(dir, { recursive: true })","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/src/main/ipc/pet.ts#L175-L211","documentation":"Thrown by the pet:import handler when classifyFile() returns null, meaning the file extension on the user's pick is not in the allowlist { .png, .apng, .jpg, .jpeg, .gif, .webp, .svg }. The classifier keys purely on lowercased extension — it does not sniff file magic — so a renamed file with an unsupported extension is rejected even if its bytes are a valid image. The dialog filter already restricts to png/jpg/jpeg/gif/webp/svg, so reaching this error implies the user bypassed the filter or picked an apng via a path the filter did not cover.","triggerScenarios":"pet:import received a filePath whose extname().toLowerCase() is absent from IMAGE_FORMATS, e.g. .bmp, .tiff, .heic, .avif, or a file with no extension. On macOS this can occur when APNG is involved because the dialog filter omits 'apng' on purpose (APNG uses .png).","commonSituations":"User dragged or past-selected a .heic (iPhone export), .bmp, or .avif; user renamed a supported image to .bin; or a platform file-picker returned a path the extension classifier does not recognize.","solutions":["Convert the asset to PNG, APNG, JPG, GIF, WebP, or SVG before importing.","If picking an APNG, ensure the file keeps its .png extension (APNG is a PNG subtype; the dialog and classifier accept .png).","Re-open the native dialog and pick via the 'Pet image' filter rather than a drag/drop from outside.","Do not pre-filter by content-type header alone — the classifier reads the on-disk extension, so the extension must literally match."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const ALLOWED = new Set(['.png', '.apng', '.jpg', '.jpeg', '.gif', '.webp', '.svg'])\nfunction isSupportedPetExt(filePath: string): boolean {\n  const ext = filePath.slice(filePath.lastIndexOf('.')).toLowerCase()\n  return ALLOWED.has(ext)\n}\n\nif (!isSupportedPetExt(pickedPath)) {\n  notify('Use a PNG, APNG, JPG, GIF, WebP, or SVG.')\n  return\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ipcRenderer.invoke('pet:import')\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unsupported file')) {\n    notify('Pick a PNG, APNG, JPG, GIF, WebP, or SVG image.')\n  } else throw e\n}","preventionTips":["Convert HEIC/BMP/TIFF/AVIF to a supported format before importing.","Keep APNG files with the .png extension.","Use the native 'Pet image' filter rather than drag/drop from outside."],"tags":["ipc","pet-overlay","file-validation","electron-dialog","asset-import"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}