can1357/oh-my-pi · error · ArchiveError

ARJ member '${memberPath}' uses unsupported compression meth

Error message

ARJ member '${memberPath}' uses unsupported compression method ${this.#method}

What it means

This ArchiveError is thrown when an ARJ member declares a compression method outside the supported set (0–4, 8, 9), e.g. newer ARJ methods this reader does not implement. The library intentionally fails fast instead of producing garbage output.

Source

Thrown at packages/utils/src/ar/arj.ts:198

				output = packed.slice();
				break;
			case 1:
			case 2:
			case 3:
				output = decompressLhStatic(packed, size, 26_624, 5, 17, `ARJ method ${this.#method}`);
				break;
			case 4:
				output = decompressArjMethod4(packed, size);
				break;
			case 8:
			case 9:
				if (size !== 0 || packed.byteLength !== 0) {
					throw new ArchiveError(`ARJ member '${memberPath}' has invalid no-data method sizes`);
				}
				output = new Uint8Array(0);
				break;
			default:
				throw new ArchiveError(`ARJ member '${memberPath}' uses unsupported compression method ${this.#method}`);
		}
		if (output.byteLength !== size)
			throw new ArchiveError(`ARJ member '${memberPath}' extracted to an unexpected size`);
		if (this.#method !== 8 && crc32(output) !== this.#crc) {
			throw new ArchiveError(`ARJ member '${memberPath}' failed CRC32 verification`);
		}
		return output;
	}
}

function normalizeHostPath(rawPath: string, hostOs: number): string {
	let path = rawPath.replaceAll("\\", "/");
	if (hostOs === 1) path = path.replaceAll(">", "/");
	else if (hostOs === 4) path = path.replaceAll(":", "/");
	return path;
}

/** Probe whether bytes begin with a CRC-framed ARJ main header. */

View on GitHub (pinned to 9690622007)

Solutions

  1. Recreate the archive using a supported ARJ method (0 stored, 1–3 LH static, 4 fast LZSS, or 8/9 no-data).
  2. Check the archiver version that produced the file and export with maximum compatibility settings (method 1 or 4).
  3. Catch ArchiveError and report/skip unsupported members, listing which memberPath uses which method.
  4. Extend or upgrade the library if support for the new method is required.

Example fix

// before
const data = await member.read(member.size, member.path);
// after
try {
  const data = await member.read(member.size, member.path);
} catch (e) {
  if (e instanceof ArchiveError && /unsupported compression method/.test(e.message)) {
    console.warn(`unsupported ARJ method for ${member.path}; re-pack archive with method 1-4`);
    return null;
  }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const SUPPORTED = new Set([0, 1, 2, 3, 4, 8, 9]);
if (!SUPPORTED.has(member.method)) {
  throw new Error(`member ${member.path} uses unsupported ARJ method ${member.method}; re-pack the archive`);
}

Type guard

function hasSupportedArjMethod(m: { method: number }): boolean {
  return [0, 1, 2, 3, 4, 8, 9].includes(m.method);
}

Try / catch

try {
  const data = await member.read(size, path);
} catch (e) {
  if (e instanceof ArchiveError && /unsupported compression method/.test(e.message)) {
    // surface which member/method, skip or re-pack
  } else throw e;
}

Prevention

When it happens

Trigger: Calling member.read(size, memberPath) on an ARJ member whose local header method byte (offset bodyStart+5) is 5, 6, 7, or any value other than 0–4 and 8–9.

Common situations: Archives created with ARJ compression modes this library does not support (higher/experimental methods), archives from newer archiver versions, or corrupted method bytes.

Related errors


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