can1357/oh-my-pi · error · Error

Unsupported PI_TINY_DTYPE=${JSON.stringify(value)}. Use auto

Error message

Unsupported PI_TINY_DTYPE=${JSON.stringify(value)}. Use auto, fp32, fp16, q8, int8, uint8, q4, bnb4, q4f16, q2, q2f16, q1, or q1f16.

What it means

normalizeTinyModelDtype validates the PI_TINY_DTYPE environment variable against the known quantization/precision values. Unknown values throw instead of falling back, because loading a different precision than requested wastes memory or breaks local model loading.

Source

Thrown at packages/coding-agent/src/tiny/dtype.ts:33

	bnb4: true,
	q4f16: true,
	q2: true,
	q2f16: true,
	q1: true,
	q1f16: true,
};

/**
 * Validate and canonicalize a `PI_TINY_DTYPE` value. Returns `undefined` when
 * unset/blank so callers fall back to the per-model spec dtype, and throws on an
 * unrecognized value so a misconfiguration fails loudly instead of silently
 * loading a different precision than requested.
 */
export function normalizeTinyModelDtype(value: string | undefined): TinyModelDtype | undefined {
	const raw = value?.trim().toLowerCase();
	if (!raw) return undefined;
	if (raw in DTYPE_VALUES) return raw as TinyModelDtype;
	throw new Error(
		`Unsupported PI_TINY_DTYPE=${JSON.stringify(value)}. Use auto, fp32, fp16, q8, int8, uint8, q4, bnb4, q4f16, q2, q2f16, q1, or q1f16.`,
	);
}

/**
 * Resolve the `PI_TINY_DTYPE` override. `undefined` means "use the per-model spec
 * dtype" (currently `q4` for every shipped model); a concrete value overrides the
 * precision for whichever local tiny model loads.
 */
export function resolveTinyModelDtypeOverride(
	value: string | undefined = $env.PI_TINY_DTYPE,
): TinyModelDtype | undefined {
	return normalizeTinyModelDtype(value);
}

/** Sentinel `providers.tinyModelDtype` value meaning "use each model's shipped dtype". */
export const TINY_MODEL_DTYPE_DEFAULT = "default";

View on GitHub (pinned to 9690622007)

Solutions

  1. Set PI_TINY_DTYPE to one of: auto, fp32, fp16, q8, int8, uint8, q4, bnb4, q4f16, q2, q2f16, q1, or q1f16
  2. Use `auto` to follow the per-model spec's preferred dtype
  3. Unset PI_TINY_DTYPE to use the per-model spec default

Example fix

// before
export PI_TINY_DTYPE=bfloat16
// after
export PI_TINY_DTYPE=fp16
Defensive patterns

Strategy: validation

Validate before calling

const DTYPES = ["auto","fp32","fp16","q8","int8","uint8","q4","bnb4","q4f16","q2","q2f16","q1","q1f16"];
const v = process.env.PI_TINY_DTYPE?.trim().toLowerCase();
if (v && !DTYPES.includes(v)) throw new Error(`PI_TINY_DTYPE must be one of ${DTYPES.join(", ")}`);

Try / catch

try {
	const dtype = normalizeTinyModelDtype(process.env.PI_TINY_DTYPE);
} catch (err) {
	logger.warn("Invalid PI_TINY_DTYPE, using per-model spec", { value: process.env.PI_TINY_DTYPE });
	return undefined;
}

Prevention

When it happens

Trigger: Setting PI_TINY_DTYPE to an unrecognized string (e.g. `int4`, `q5`, `float16`) and resolving the dtype override.

Common situations: Using dtype names from other runtimes (torch `bfloat16`, llama.cpp `q5_k_m`) that aren't in the supported list; typos like `fp16 ` or `Q8` (casing is normalized, spelling must match exactly).

Related errors


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