agentscope-ai/agentscope · error · ValueError

Invalid inputs with reply_id: {inputs.reply_id}.

Error message

Invalid inputs with reply_id: {inputs.reply_id}. 

What it means

GoalPipeline.reply_stream routes incoming events by matching inputs.reply_id against the executor's or verifier's state reply_id. An event whose reply_id matches neither is rejected as invalid — it belongs to a different/unknown reply thread.

Source

Thrown at src/agentscope/pipeline/_goal_pipeline.py:159

                    self._goal.extend(_.content)
                executor_inputs.append(
                    UserMsg("system", content=hint),
                )

        elif isinstance(
            inputs,
            (
                UserConfirmResultEvent,
                UserInterruptEvent,
                ExternalExecutionResultEvent,
            ),
        ):
            if inputs.reply_id == self.executor.state.reply_id:
                executor_inputs = inputs
            elif inputs.reply_id == self.verifier.state.reply_id:
                verifier_inputs = inputs
            else:
                raise ValueError(
                    f"Invalid inputs with reply_id: {inputs.reply_id}. ",
                )

        if isinstance(inputs, UserInterruptEvent):
            parked = (
                self.verifier if verifier_inputs is not None else self.executor
            )
            async for _ in parked.reply_stream(inputs=inputs):
                yield _
            return

        # Start the pipeline loop
        while True:
            # Executor step
            break_loop = False
            execution_report = None
            if executor_inputs is not None:
                while execution_report is None:

View on GitHub (pinned to e90f1c7592)

Solutions

  1. Regenerate the input event via pipeline.new_reply()/the API that assigns the current reply_id instead of reusing old events
  2. Track the current reply_id and drop/refresh events whose id doesn't match before calling reply_stream
  3. Reset the pipeline consistently when starting a new conversation so state and events stay in sync

Example fix

# before
async for ev in pipeline.reply_stream(old_event):  # stale reply_id
    ...

# after
event = await pipeline.new_reply(...)  # fresh reply_id
async for ev in pipeline.reply_stream(event):
    ...
Defensive patterns

Strategy: validation

Validate before calling

current_ids = {pipeline.executor.state.reply_id, pipeline.verifier.state.reply_id}
if getattr(inputs, 'reply_id', None) not in current_ids:
    inputs = await pipeline.new_reply(inputs.content)  # refresh id

Type guard

def event_matches_pipeline(event, pipeline) -> bool:
    return event.reply_id in (pipeline.executor.state.reply_id, pipeline.verifier.state.reply_id)

Prevention

When it happens

Trigger: Feeding an event carrying a stale or foreign reply_id into reply_stream, e.g. reusing an event from a previous pipeline run or from another conversation after the pipeline's state was reset.

Common situations: Replaying recorded events; sharing a pipeline across sessions; resuming after interrupt where the state got a new reply_id but queued old events are still fed in.

Related errors


AI-assisted analysis of agentscope-ai/agentscope@e90f1c7592 (2026-08-28). Data as JSON: /api/errors/49832ba116914a5a. Report an issue: GitHub.