{"record":{"id":"8ef9ecdc07f7c7f5","repo":"Budibase/budibase","slug":"error-enriching-pwa-icons-error","errorCode":null,"errorMessage":"Error enriching PWA icons: ${error}","messagePattern":"Error enriching PWA icons: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/api/controllers/static/index.ts","lineNumber":616,"sourceCode":"          try {\n            // Enrich all icons\n            const enrichedIcons = await objectStore.enrichPWAImages(\n              appInfo.pwa.icons\n            )\n\n            let appleTouchIcon = enrichedIcons.find(\n              icon => icon.sizes === \"180x180\"\n            )\n\n            if (!appleTouchIcon && enrichedIcons.length > 0) {\n              appleTouchIcon = enrichedIcons[0]\n            }\n\n            if (appleTouchIcon) {\n              extraHead += `<link rel=\"apple-touch-icon\" sizes=\"${appleTouchIcon.sizes}\" href=\"${appleTouchIcon.src}\">`\n            }\n          } catch (error) {\n            throw new Error(\"Error enriching PWA icons: \" + error)\n          }\n        }\n      }\n\n      ctx.body = await processString(appHbs, {\n        head: `${head}${extraHead}`,\n        body: body,\n        css: `:root{${themeVariables}}`,\n        appId: workspaceId,\n        embedded: bbHeaderEmbed,\n        nonce: ctx.state.nonce,\n      })\n    } else {\n      // just return the app info for jest to assert on\n      ctx.body = { ...appInfo, clientCacheKey, clientLibPath }\n    }\n  } catch (error: any) {\n    let msg = \"An unknown error occurred\"","sourceCodeStart":598,"sourceCodeEnd":634,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/api/controllers/static/index.ts#L598-L634","documentation":"When serving an app HTML page, serveApp tries to enrich the head with PWA icon links (manifest/apple-touch-icon). If that enrichment logic throws for any reason, it is wrapped in 'Error enriching PWA icons: <error>' — meaning the app render fails because icon metadata could not be resolved or templated.","triggerScenarios":"Requesting an app page whose workspace has partial/corrupt PWA icon metadata — e.g. manifest.icon points to a deleted object, appleTouchIcon fields are undefined/malformed, or an exception inside the icon-resolution try block (bad S3 key, template interpolation failure).","commonSituations":"Icons deleted from storage after PWA was configured; an earlier upload failure (error 342) leaving inconsistent icon metadata; hand-edited workspace metadata with missing sizes/src.","solutions":["Read the wrapped root cause in the message and fix the underlying icon metadata issue","Re-upload valid PWA icons via the PWA zip flow to regenerate metadata","Remove/reset the PWA icon configuration for the app if icons are no longer needed","Check object storage for the icon keys referenced by the workspace metadata"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify icon objects are intact before relying on PWA rendering\nconst ok = icon => icon && typeof icon.src === \"string\" && typeof icon.sizes === \"string\"\nif (pwaConfig?.manifest?.icons && !pwaConfig.manifest.icons.every(ok)) throw new Error(\"corrupt PWA icon metadata\")","typeGuard":"const isValidIcon = (i) => Boolean(i) && typeof i === \"object\" && typeof i.src === \"string\" && typeof i.sizes === \"string\"","tryCatchPattern":"try {\n  html = await fetch(appUrl).then(r => r.text())\n} catch (e) {\n  if (/Error enriching PWA icons/.test(e.message)) {\n    // re-upload or reset PWA icons for the workspace, then retry\n  } else throw e\n}","preventionTips":["Re-upload icons after any object-storage cleanup","Avoid hand-editing workspace PWA metadata","Rebuild PWA config from a fresh icon zip after migrations","Monitor storage for deleted icon keys"],"tags":["pwa","rendering","icons"],"backgroundTag":"asset-upload-failed","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}