{"record":{"id":"a04b8470db8556b3","repo":"vercel/ai","slug":"the-harnessid-acp-harness-supports-only-portabl-a04b84","errorCode":null,"errorMessage":"The ${harnessId} ACP harness supports only portable text prompts and does not support content parts of type ${JSON.stringify((part as { readonly type?: unknown }).type)}. Pass a string or a user message whose content contains only text parts.","messagePattern":"The (.+?) ACP harness supports only portable text prompts and does not support content parts of type (.+?)\\)\\.type\\)\\}\\. Pass a string or a user message whose content contains only text parts\\.","errorType":"exception","errorClass":"HarnessCapabilityUnsupportedError","httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/acp-v1-prompt.ts","lineNumber":59,"sourceCode":"      const mediaCategory = part.mediaType.toLowerCase().split('/', 1)[0];\n      if (mediaCategory === 'image') {\n        throw unsupportedPromptContent({\n          harnessId,\n          category: 'image content',\n        });\n      }\n      if (mediaCategory === 'audio') {\n        throw unsupportedPromptContent({\n          harnessId,\n          category: 'audio content',\n        });\n      }\n      throw unsupportedPromptContent({\n        harnessId,\n        category: `embedded resource content with media type ${JSON.stringify(part.mediaType)}`,\n      });\n    }\n    throw unsupportedPromptContent({\n      harnessId,\n      category: `content parts of type ${JSON.stringify(\n        (part as { readonly type?: unknown }).type,\n      )}`,\n    });\n  }\n  return content;\n}\n\nexport function prependACPInstructionGuidance({\n  prompt,\n  instructions,\n}: {\n  prompt: ReadonlyArray<ACPTextContentBlock>;\n  instructions: string | undefined;\n}): ACPTextContentBlock[] {\n  const hasInstructions = instructions != null && instructions.length > 0;\n  if (!hasInstructions) return [...prompt];","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/acp-v1-prompt.ts#L41-L77","documentation":"Final catch-all in convertHarnessPromptToACPTextBlocks: any content part whose type is not 'text', 'image', or 'file' triggers unsupportedPromptContent with the unknown part type embedded in the message. The ACP v1 harness only accepts text content parts.","triggerScenarios":"Prompting an ACP v1 harness with a content part of an unrecognized/unsupported type (e.g. 'tool-result', 'resource', or a part from a newer SDK version) inside prompt.content.","commonSituations":"SDK version mismatches introducing new part types; generic message-forwarding code passing arbitrary provider part types straight into the harness prompt.","solutions":["Ensure prompt.content contains only text parts before calling the harness.","Upgrade or align the SDK packages so part types match what HarnessV1 defines and ACP supports.","Add a mapper that converts or drops non-text parts prior to prompting."],"exampleFix":"// before\ncontent: [...msg.content] // may include { type: 'tool-result', ... }\n// after\ncontent: msg.content.filter(p => p.type === 'text')","handlingStrategy":"validation","validationCode":"const unknown = typeof prompt !== 'string' &&\n  Array.isArray(prompt.content) &&\n  prompt.content.filter(p => p.type !== 'text' && p.type !== 'image' && p.type !== 'file');\nif (unknown.length) throw new Error(`Unknown content part types: ${unknown.map(p => p.type).join(', ')}`);","typeGuard":"function isKnownPart(part: unknown): boolean {\n  const t = (part as { type?: unknown })?.type;\n  return t === 'text' || t === 'image' || t === 'file';\n}","tryCatchPattern":"try {\n  await session.prompt(msg);\n} catch (e) {\n  if (String(e?.message).includes('content parts of type')) {\n    await session.prompt({ content: msg.content.filter(isKnownPartAndTextOnly) });\n  } else throw e;\n}","preventionTips":["Keep SDK package versions in sync so part types stay within the known union","Whitelist part types at the boundary where messages enter the harness","Log and drop unrecognized parts instead of forwarding them"],"tags":["acp","unsupported-content","content-parts"],"backgroundTag":"unsupported-prompt-content","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}