vercel/ai · error

maxInputBytesPerCall must be greater than 0

Error message

maxInputBytesPerCall must be greater than 0

What it means

Each skill must have a unique name, since the name becomes its directory under the skills root. validateACPSkills tracks names in a set and throws on the second occurrence. Duplicates would silently overwrite each other's files, so they are rejected up front.

Solutions

  1. Deduplicate skills by name before passing them (keep the intended one, e.g. project over user-level).
  2. Rename one of the conflicting skills to a distinct kebab-case slug.
  3. Detect conflicts early by building a Set of names and asserting uniqueness in your loader.

Example fix

// before
[{ name: 'reviewer' }, { name: 'reviewer' }]

// after
[{ name: 'project-reviewer' }, { name: 'user-reviewer' }]
Defensive patterns

Strategy: validation

Validate before calling

function dedupeSkills(skills: Array<{ name: string }> ) {
  const seen = new Set<string>();
  const out: typeof skills = [];
  for (const s of skills) {
    if (seen.has(s.name)) continue; // or rename
    seen.add(s.name);
    out.push(s);
  }
  return out;
}

Try / catch

try {
  await agent.addSkills(mergedSkills);
} catch (error) {
  if (error instanceof Error && error.message.startsWith('Duplicate ACP skill name')) {
    const dup = error.message.match(/"([^"]+)"/)?.[1];
    await agent.addSkills(dedupeSkills(mergedSkills).filter(s => s.name !== dup || keepPreferred(s)));
  } else {
    throw error;
  }
}

Prevention

When it happens

Trigger: Passing an array of skills to the ACP harness where two entries share the same name (e.g. merging skill lists from multiple sources without deduplication).

Common situations: Concatenating project-level and user-level skill collections that both define a 'code-reviewer' skill; loading skills from several directories with clashing basenames; generating skills in a loop with a reused name.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/5c2aa330230ccccf. Report an issue: GitHub.

Appendix: source

Thrown at packages/ai/src/embed/embed-many.ts:455

}

const textEncoder = new TextEncoder();

function splitByEmbeddingLimits({
  values,
  maxEmbeddingsPerCall,
  maxInputBytesPerCall,
}: {
  values: Array<string>;
  maxEmbeddingsPerCall: number;
  maxInputBytesPerCall: number;
}): Array<Array<string>> {
  if (maxEmbeddingsPerCall <= 0) {
    throw new Error('maxEmbeddingsPerCall must be greater than 0');
  }

  if (maxInputBytesPerCall <= 0) {
    throw new Error('maxInputBytesPerCall must be greater than 0');
  }

  if (values.length === 0) {
    return [];
  }

  const chunks: Array<Array<string>> = [];
  let currentChunk: Array<string> = [];
  let currentInputBytes = 0;

  for (const value of values) {
    const inputBytes = textEncoder.encode(value).length;

    if (
      currentChunk.length > 0 &&
      (currentChunk.length >= maxEmbeddingsPerCall ||
        currentInputBytes + inputBytes > maxInputBytesPerCall)
    ) {

View on GitHub (pinned to 69428b1f8b)