open-webui/open-webui · warning · Error

No PNG text chunk named "${textChunkKeyword}" found

Error message

No PNG text chunk named "${textChunkKeyword}" found

What it means

Thrown by POST /api/v1/knowledge/{id}/file/remove when the file exists in the Files table but Knowledges.has_file reports no (knowledge_id, file_id) link — i.e. the file was never added to this knowledge base, or was already removed. This is the 'file does not belong to this knowledge base' guard and returns 400 with NOT_FOUND.

Source

Thrown at src/lib/utils/characters/index.ts:54

		file,
		json,
		image,
		formats: detectFormats(json),
		character
	};
};

const parsePngText = (arrayBuffer) => {
	const textChunkKeyword = 'chara';
	const chunks = readPngChunks(new Uint8Array(arrayBuffer));

	const textChunk = chunks
		.filter((chunk) => chunk.type === 'tEXt')
		.map((chunk) => decodeTextChunk(chunk.data))
		.find((entry) => entry.keyword === textChunkKeyword);

	if (!textChunk) {
		throw new Error(`No PNG text chunk named "${textChunkKeyword}" found`);
	}

	try {
		return new TextDecoder().decode(Uint8Array.from(atob(textChunk.text), (c) => c.charCodeAt(0)));
	} catch (e) {
		throw new Error('Unable to parse "chara" field as base64', e);
	}
};

const readPngChunks = (data) => {
	const isValidPng =
		data[0] === 0x89 &&
		data[1] === 0x50 &&
		data[2] === 0x4e &&
		data[3] === 0x47 &&
		data[4] === 0x0d &&
		data[5] === 0x0a &&
		data[6] === 0x1a &&

View on GitHub (pinned to 01f4282f1f)

Solutions

  1. Treat this error as success for idempotent remove flows — the end state (file not in KB) is already achieved.
  2. Confirm the target knowledge id matches the knowledge base the file actually belongs to.
  3. Refresh the file list for the knowledge base before offering a remove action.

Example fix

// before
try { await removeFile(kbId, { file_id }); } catch { throw; }

// after
try { await removeFile(kbId, { file_id }); }
catch (e) { if (!/could not find/.test(e.detail)) throw e; /* already removed */ }
Defensive patterns

Strategy: try-catch

Validate before calling

const kb = await getKnowledge(id);
const isMember = kb.files.some(f => f.id === form.file_id);
if (!isMember) return; // nothing to remove — already absent

Try / catch

try { await removeFileFromKnowledge(id, form); }
catch (e) { if (e.status === 400 && /could not find/.test(e.detail)) return; /* idempotent success */ throw e; }

Prevention

When it happens

Trigger: Calling remove with a valid global file_id that belongs to a different knowledge base or to no knowledge base at all; double-submitting the same remove request.

Common situations: Same file added to multiple knowledge bases and the client removes it from the wrong one; idempotent retry after the first remove already succeeded; UI state out of sync with the join table.

Related errors


AI-assisted analysis of open-webui/open-webui@01f4282f1f (2026-08-14). Data as JSON: /api/errors/89952dc07dfb270c. Report an issue: GitHub.