vercel/ai · error · InvalidArgumentError
Invalid argument for parameter model: model ${model.provider
Error message
Invalid argument for parameter model: model ${model.provider}:${model.modelId} is not compatible with batch ${batch.provider}:${batch.modelId} What it means
resolveACPSkillsDirectory validates the configured skillsDirectory before joining it with the implementation home dir. It must be a non-empty, relative POSIX path (no backslashes, no absolute paths on either POSIX or Windows semantics) with no '..' traversal segments and must not normalize to '.' or escape upward. Anything else is rejected to keep skills inside the implementation home and outside the session work dir.
Source
Thrown at packages/ai/src/batch/batch.ts:292
}
function validateBatchReference({
model,
batch,
}: {
model: BatchLanguageModelV4;
batch: BatchReference;
}) {
if (batch.version !== 1 || batch.type !== 'text') {
throw new InvalidArgumentError({
parameter: 'batch',
value: batch,
message: 'batch must be a supported text batch reference',
});
}
if (batch.provider !== model.provider || batch.modelId !== model.modelId) {
throw new InvalidArgumentError({
parameter: 'model',
value: model,
message:
`model ${model.provider}:${model.modelId} is not compatible with ` +
`batch ${batch.provider}:${batch.modelId}`,
});
}
}
async function convertBatchItemResult(
item: BatchV4ItemResult<LanguageModelV4GenerateResult>,
): Promise<TextBatchItemResult> {
if (item.status !== 'succeeded') {
return item;
}
return {
id: item.id,View on GitHub (pinned to 69428b1f8b)
Solutions
- Use a relative POSIX path like '.agents/skills' or 'skills'.
- Remove any '..' segments and backslashes from the value.
- If you need an absolute or external location, mount/link it under the implementation home and reference it relatively.
- Sanitize or validate user-supplied paths before passing them as skillsDirectory.
Example fix
// before
createACPV1({ skillsDirectory: 'C:\\tools\\skills' })
// after
createACPV1({ skillsDirectory: '.agents/skills' }) Defensive patterns
Strategy: validation
Validate before calling
const RELATIVE_POSIX = /^(?!\/)(?!\\)(?![A-Za-z]:)(?!.*(?:^|[/\\])\.\.?(?:[/\\]|$))[\w.\-/]+$/;
function isValidSkillsDirectory(dir: string): boolean {
return dir.length > 0 && RELATIVE_POSIX.test(dir) && !dir.includes('\\');
}
// e.g. isValidSkillsDirectory('.agents/skills') === true Type guard
function isSafeRelativePosixPath(p: string): p is string {
return (
p.length > 0 &&
!p.includes('\\') &&
!p.startsWith('/') &&
!/^[A-Za-z]:/.test(p) &&
!p.split('/').includes('..') &&
p !== '.'
);
} Try / catch
try {
configureHarness({ skillsDirectory });
} catch (error) {
if (error instanceof Error && error.message.includes('must be a relative POSIX path')) {
configureHarness({ skillsDirectory: '.agents/skills' }); // safe default
} else {
throw error;
}
} Prevention
- Always use forward slashes and relative paths like '.agents/skills'.
- Never build the directory from raw user input without sanitizing '..' and backslashes.
- Avoid absolute paths and Windows drive letters in configuration.
When it happens
Trigger: Passing skillsDirectory values such as '', 'C:\agents\skills', '/etc/skills', '../skills', 'skills/../../escape', '.', or a Windows-separated path when creating/configuring the ACP harness skills directory.
Common situations: Copying a Windows path from Explorer into config; using an absolute path because the docs example looked relative; constructing the path with user input containing '..'; empty string from an unset env var.
Related errors
- ACP credentialEnv and credentialBrokering must be configured
- ACP credentialEnv and credentialBrokering must be configured
- ACP authentication and session profile settings cannot chang
- ACP MCP server ${JSON.stringify(name)} must be configured wi
- ACP-transport MCP servers require client-side mcp/connect ha
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/616e97193aff995e.
Report an issue: GitHub.