ruvnet/ruflo · error

invalid APSC agentId

Error message

invalid APSC agentId

What it means

recordApscSignal() rejected the incoming signal's agentId — it failed whatever identity validation the function applies (empty/non-string). The signal is dropped before it can touch the agent table because there is no agent record to attribute it to.

Source

Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:161

function counts(state: ApscState): { activeAgents: number; suspendedAgents: number } {
  const values = Object.values(state.agents);
  return {
    activeAgents: values.filter((agent) => agent.status === 'active').length,
    suspendedAgents: values.filter((agent) => agent.status === 'suspended').length,
  };
}

function protectedRole(state: ApscState, role: string): boolean {
  return state.config.protectedRoles.includes(role.toLowerCase());
}

export function recordApscSignal(
  current: ApscState,
  signal: ApscSignal,
  now = Date.now(),
): { state: ApscState; decision: ApscDecision } {
  if (!/^[A-Za-z0-9._:-]{1,160}$/.test(signal.agentId)) throw new Error('invalid APSC agentId');
  if (!/^[A-Za-z0-9._:-]{1,100}$/.test(signal.role)) throw new Error('invalid APSC role');
  const config = normalizeApscConfig(current.config);
  const state: ApscState = {
    ...current,
    config,
    round: current.round + 1,
    roleBaselines: { ...current.roleBaselines },
    agents: Object.fromEntries(Object.entries(current.agents).map(([id, agent]) => [id, { ...agent }])),
  };
  const success = unit(signal.taskSuccess, 'taskSuccess');
  const latency = unit(signal.normalizedLatency, 'normalizedLatency');
  const alignment = unit(signal.consensusAlignment, 'consensusAlignment');
  const rawScore = config.alpha * success + config.beta * (1 - latency) + config.gamma * alignment;

  const role = signal.role.toLowerCase();
  // Compare against peers in the same role, excluding the current agent.
  // Letting an agent update its own baseline before normalization caused a
  // persistently weak agent to redefine "normal" downward and reactivate

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Provide a valid APSC agent identifier (non-empty string)

Example fix

Pass a valid APSC agentId (non-empty string of a known agent).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/services/pheromone-adaptive.ts:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/6f9ab7027cb2e937. Report an issue: GitHub.