{"record":{"id":"616e97193aff995e","repo":"vercel/ai","slug":"invalid-argument-for-parameter-model-model-mode","errorCode":null,"errorMessage":"Invalid argument for parameter model: model ${model.provider}:${model.modelId} is not compatible with batch ${batch.provider}:${batch.modelId}","messagePattern":"Invalid argument for parameter model: model (.+?):(.+?) is not compatible with batch (.+?):(.+?)","errorType":"validation","errorClass":"InvalidArgumentError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/batch/batch.ts","lineNumber":292,"sourceCode":"}\n\nfunction validateBatchReference({\n  model,\n  batch,\n}: {\n  model: BatchLanguageModelV4;\n  batch: BatchReference;\n}) {\n  if (batch.version !== 1 || batch.type !== 'text') {\n    throw new InvalidArgumentError({\n      parameter: 'batch',\n      value: batch,\n      message: 'batch must be a supported text batch reference',\n    });\n  }\n\n  if (batch.provider !== model.provider || batch.modelId !== model.modelId) {\n    throw new InvalidArgumentError({\n      parameter: 'model',\n      value: model,\n      message:\n        `model ${model.provider}:${model.modelId} is not compatible with ` +\n        `batch ${batch.provider}:${batch.modelId}`,\n    });\n  }\n}\n\nasync function convertBatchItemResult(\n  item: BatchV4ItemResult<LanguageModelV4GenerateResult>,\n): Promise<TextBatchItemResult> {\n  if (item.status !== 'succeeded') {\n    return item;\n  }\n\n  return {\n    id: item.id,","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/batch/batch.ts#L274-L310","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ncreateACPV1({ skillsDirectory: 'C:\\\\tools\\\\skills' })\n\n// after\ncreateACPV1({ skillsDirectory: '.agents/skills' })","handlingStrategy":"validation","validationCode":"const RELATIVE_POSIX = /^(?!\\/)(?!\\\\)(?![A-Za-z]:)(?!.*(?:^|[/\\\\])\\.\\.?(?:[/\\\\]|$))[\\w.\\-/]+$/;\nfunction isValidSkillsDirectory(dir: string): boolean {\n  return dir.length > 0 && RELATIVE_POSIX.test(dir) && !dir.includes('\\\\');\n}\n// e.g. isValidSkillsDirectory('.agents/skills') === true","typeGuard":"function isSafeRelativePosixPath(p: string): p is string {\n  return (\n    p.length > 0 &&\n    !p.includes('\\\\') &&\n    !p.startsWith('/') &&\n    !/^[A-Za-z]:/.test(p) &&\n    !p.split('/').includes('..') &&\n    p !== '.'\n  );\n}","tryCatchPattern":"try {\n  configureHarness({ skillsDirectory });\n} catch (error) {\n  if (error instanceof Error && error.message.includes('must be a relative POSIX path')) {\n    configureHarness({ skillsDirectory: '.agents/skills' }); // safe default\n  } else {\n    throw error;\n  }\n}","preventionTips":["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."],"tags":["acp","path-validation","configuration","path-traversal"],"backgroundTag":"invalid-path","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}