ruvnet/ruflo · warning · Error
Serialization format '${format}' is not implemented. Use 'js
Error message
Serialization format '${format}' is not implemented. Use 'json' instead. What it means
serializeToBuffer(cfp, format) only implements JSON. The format union includes cbor, cbor.gz, cbor.zstd and msgpack, but those cases explicitly throw — the source comments say a production build would use cbor-x or msgpack, but no encoder is wired in. Only 'json' (and any unrecognized value, via the default branch) returns a Buffer, so requesting a compact binary format is a known unimplemented capability.
Source
Thrown at v3/@claude-flow/cli/src/transfer/serialization/cfp.ts:132
return JSON.stringify(cfp, null, 2);
}
/**
* Serialize CFP to Buffer (for CBOR/binary formats)
*/
export function serializeToBuffer(cfp: CFPFormat, format: SerializationFormat): Buffer {
// For now, just use JSON - in production, would use cbor-x or msgpack
const json = serializeToJson(cfp);
switch (format) {
case 'json':
return Buffer.from(json, 'utf-8');
case 'cbor':
case 'cbor.gz':
case 'cbor.zstd':
case 'msgpack':
throw new Error(`Serialization format '${format}' is not implemented. Use 'json' instead.`);
default:
return Buffer.from(json, 'utf-8');
}
}
/**
* Deserialize CFP from string/buffer
*/
export function deserializeCFP(data: string | Buffer): CFPFormat {
const str = typeof data === 'string' ? data : data.toString('utf-8');
let parsed: CFPFormat;
try {
parsed = JSON.parse(str);
} catch (e) {
throw new Error(`Invalid CFP file: ${e instanceof Error ? e.message : String(e)}`);
}
View on GitHub (pinned to fa13ee4ad6)
Solutions
- Use 'json' — the only implemented serialization for CFP transfer
- If you need compression, compress the JSON buffer yourself after serializeToBuffer(cfp, 'json') (e.g. zlib.gzipSync)
- Watch or contribute the upstream issue — cbor-x/msgpack integration is explicitly deferred in the source
- Whitelist format values in your UI/config so binary formats cannot be selected
Example fix
// before
const buf = serializeToBuffer(cfp, 'cbor'); // throws: not implemented
// after
import { gzipSync } from 'node:zlib';
const buf = gzipSync(serializeToBuffer(cfp, 'json')); // JSON + gzip when size matters Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_FORMATS = ['json'] as const;
if (!SUPPORTED_FORMATS.includes(format)) {
throw new Error(`Format '${format}' not supported here; only ${SUPPORTED_FORMATS.join(', ')} is implemented`);
}
const buf = serializeToBuffer(cfp, format); Type guard
const SUPPORTED_SERIALIZATION_FORMATS = ['json'] as const;
export type SupportedSerializationFormat = (typeof SUPPORTED_SERIALIZATION_FORMATS)[number];
function isSupportedSerializationFormat(value: unknown): value is SupportedSerializationFormat {
return value === 'json'; // cbor/cbor.gz/cbor.zstd/msgpack are declared but NOT implemented
} Prevention
- Restrict any user-facing 'format' option to 'json' until binary codecs ship upstream
- Do not infer capability from the TypeScript union — the extra literals are stubs that throw
- If size matters, compress the JSON buffer yourself with zlib instead of requesting cbor
When it happens
Trigger: Calling serializeToBuffer(cfp, 'cbor'), 'cbor.gz', 'cbor.zstd' or 'msgpack' on the CFP transfer path; config/CLI options that expose a format field and let users pick a binary encoding.
Common situations: Users choosing cbor to shrink large pattern files (the motivation for the union existing); copying example code that references msgpack; assuming the type union implies implemented support.
Related errors
- Invalid CFP file: ${e instanceof Error ? e.message : String(
- Invalid CFP format: expected magic 'CFP1', got '${parsed.mag
- approval issuance requires an authenticated human identity a
- unsupported calibrator schema v=${j?.v}
- canonical JSON does not support lone UTF-16 surrogates
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/984408352ace4040.
Report an issue: GitHub.