can1357/oh-my-pi · error · Error

Unsupported format

Error message

Unsupported format: ${streamInfo.extension || streamInfo.mimetype || "unknown"}

What it means

Thrown when no registered converter accepts the stream's extension or mimetype — the format is not supported at all, distinct from 'Conversion failed' where converters existed but errored. The message reports the extension, then mimetype, then 'unknown'.

Solutions

  1. Check supported formats and convert the file to one (pdf, docx, epub, xlsx, pptx, html, etc.) before calling.
  2. Provide a filename with a proper extension and/or set the mimetype so the registry can route the stream.
  3. Upgrade the package if a newer version added a converter for your format.
  4. If the file has no type info, pass explicit mimetype/extension to the convert call.

Example fix

// before
await markit.convert(blob); // no name/mimetype -> 'Unsupported format: unknown'
// after
await markit.convert(blob, "application/vnd.oasis.opendocument.text"); // or convert to docx/pdf first
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(["pdf", "docx", "epub", "xlsx", "pptx", "html", "htm", "md", "txt"]);
function assertSupported(filename: string): void {
  const ext = filename.split(".").pop()?.toLowerCase() ?? "";
  if (!SUPPORTED.has(ext)) throw new Error(`Pre-check: unsupported extension .${ext}`);
}

Try / catch

try {
  const result = await markit.convertFile("file.rtf");
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Unsupported format:")) {
    // route to an external converter or inform the user of supported formats
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling Markit.convert/convertFile with a file whose extension and mimetype match no converter in the registry (e.g. .rtf, .odp, binary types), or with neither extension nor mimetype (message shows 'unknown').

Common situations: Passing a file type outside the supported set; providing a Blob/stream with no name so no extension/mimetype is inferable; unusual casing or double extensions; older build missing a newly added converter.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/4686aad7277f5be1. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/markit/registry.ts:57

		};
		return this.convert(buffer, streamInfo);
	}

	async convert(input: Buffer, streamInfo: StreamInfo): Promise<ConversionResult> {
		const errors: { converter: string; error: Error }[] = [];
		for (const converter of this.#converters) {
			if (!converter.accepts(streamInfo)) continue;
			try {
				return await converter.convert(input, streamInfo, this.#options);
			} catch (err) {
				errors.push({ converter: converter.name, error: err instanceof Error ? err : new Error(String(err)) });
			}
		}
		if (errors.length > 0) {
			const details = errors.map(e => `  ${e.converter}: ${e.error.message}`).join("\n");
			throw new Error(`Conversion failed:\n${details}`);
		}
		throw new Error(`Unsupported format: ${streamInfo.extension || streamInfo.mimetype || "unknown"}`);
	}
}

View on GitHub (pinned to 9690622007)