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

  1. Use 'json' — the only implemented serialization for CFP transfer
  2. If you need compression, compress the JSON buffer yourself after serializeToBuffer(cfp, 'json') (e.g. zlib.gzipSync)
  3. Watch or contribute the upstream issue — cbor-x/msgpack integration is explicitly deferred in the source
  4. 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

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


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/984408352ace4040. Report an issue: GitHub.