vercel/ai · error · InvalidArgumentError

Invalid argument for parameter requests: requests must not b

Error message

Invalid argument for parameter requests: requests must not be empty

What it means

validateACPLifecycleCompatibility checks persisted ACP lifecycle state before it is adopted by createACPV1. The state records which harness id produced it; if that id differs from the harness id of the current instance, the state is not transferable between harnesses and is rejected. This prevents resuming state across incompatible harness implementations.

Source

Thrown at packages/ai/src/batch/batch.ts:246

  }

  return model;
}

function isBatchLanguageModel(
  model: LanguageModelV4,
): model is BatchLanguageModelV4 {
  const candidate = model as Partial<BatchLanguageModelV4>;
  return (
    typeof candidate.experimental_doStartBatch === 'function' &&
    typeof candidate.experimental_doGetBatchStatus === 'function' &&
    typeof candidate.experimental_doGetBatchResults === 'function'
  );
}

function validateRequests(requests: ReadonlyArray<TextBatchRequest>) {
  if (requests.length === 0) {
    throw new InvalidArgumentError({
      parameter: 'requests',
      value: requests,
      message: 'requests must not be empty',
    });
  }

  const ids = new Set<string>();

  for (const request of requests) {
    if (request.id.trim().length === 0) {
      throw new InvalidArgumentError({
        parameter: 'requests',
        value: requests,
        message: 'request IDs must not be empty',
      });
    }

    if (ids.has(request.id)) {

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use lifecycle state that was produced by this exact harness (same harnessId).
  2. Regenerate the session/lifecycle state with the current harness instead of resuming foreign state.
  3. If migrating harnesses deliberately, re-run the session under the new harness from scratch; state is not portable.

Example fix

// before
createACPV1({ harnessId: 'acp-v1-claude', lifecycle: stateFromOtherHarness })

// after
const state = await captureLifecycle({ harnessId: 'acp-v1-claude' });
createACPV1({ harnessId: 'acp-v1-claude', lifecycle: state })
Defensive patterns

Strategy: validation

Validate before calling

if (lifecycleData.harnessId !== harnessId) {
  throw new Error(`Lifecycle state from ${lifecycleData.harnessId} cannot be resumed by ${harnessId}`);
}

Try / catch

try {
  harness = createACPV1({ lifecycle: state });
} catch (error) {
  if (error instanceof Error && error.message.includes('was produced by harness')) {
    // foreign lifecycle state: start a fresh session
    harness = createACPV1({});
  } else {
    throw error;
  }
}

Prevention

When it happens

Trigger: Calling createACPV1 with lifecycleData whose harnessId differs from the current harness's id, e.g. passing lifecycle state captured by harness-acp v1 into a different harness package or a harness configured under a different id.

Common situations: Migrating sessions between harness packages (e.g. harness-acp to a future harness); reusing serialized lifecycle state from another agent runtime; a typo or changed harnessId string in config.

Related errors


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