mickael-kerjean/filestash · error · Error

Missing Key

Error message

Missing Key

What it means

Thrown by the PGP widget's decode flow when a fetched encrypted resource has byteLength === 0. It is a sentinel guard meaning the fetch succeeded but the source contained no data, so there is nothing to decrypt; the widget returns a Blob URL for the empty buffer instead of entering the decrypt modal.

Source

Thrown at server/plugin/plg_widget_pgp/assets/pgp.js:42

            <style>${CSS}</style>
        </div>
    `);
    const encrypted = await new Promise(async (done, error) => {
        try {
            const res = await fetch(src);
            done(await res.arrayBuffer());
        } catch (err) {
            error(err);
        }
    });
    if (encrypted.byteLength === 0) {
        return URL.createObjectURL(new Blob([encrypted]));
    }
    return new Promise((done) => createModal({ withButtonsRight: "decrypt", withButtonsLeft: "cancel" })($page, async (n) => {
        if (n !== MODAL_RIGHT_BUTTON) return done(src);
        try {
            const file = qs($page, "input").files?.[0];
            if (!file) throw new Error("Missing Key");
            const privateKey = await openpgp.readPrivateKey({
                armoredKey: await file.text(),
            });
            KEY = privateKey;
            const { data } = await openpgp.decrypt({
                message: await openpgp.readMessage({
                    binaryMessage: new Uint8Array(encrypted),
                }),
                decryptionKeys: privateKey,
                format: "binary",
            });
            done(URL.createObjectURL(new Blob([data])));
        } catch (err) {
            notification.error(err);
            done(src);
        } finally {
            $page.remove();
        }

View on GitHub (pinned to 78f756eb94)

Solutions

  1. Verify the source URL points to a non-empty PGP-encrypted file and that the upload/write step actually persisted content
  2. Fetch the resource manually (curl/wget) to confirm it returns bytes
  3. Check that the storage backend is not returning empty bodies for missing or truncated files
  4. Include the source URL in the error message to identify the empty resource
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/plugin/plg_widget_pgp/assets/pgp.js:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mickael-kerjean/filestash@78f756eb94 (2026-09-06). Data as JSON: /api/errors/2913fe01db0e6639. Report an issue: GitHub.