paperclipai/paperclip · error

Probe found no matching Anthropic Environment

Error message

Probe found no matching Anthropic Environment

What it means

resolveEnvironment looks up an Anthropic cloud Environment matching the Paperclip profile (by explicit environmentId or by profile metadata). When options.probe is set, the function runs in dry-run mode: it must NOT create anything, so if no matching environment exists it throws instead of POSTing a new one. This is the probe contract failing because the remote resource has not been provisioned yet.

Source

Thrown at cli/src/commands/managed-agent.ts:241

    const environment = await anthropicRequest(
      key,
      "GET",
      `/v1/environments/${encodeURIComponent(options.environmentId)}`,
    );
    assertSafeManagedEnvironment(environment);
    return environment;
  }

  const existing = resourceByProfile(
    await listAll(key, "/v1/environments"),
    options.profileKey,
    "Environment",
  );
  if (existing) {
    assertSafeManagedEnvironment(existing);
    return existing;
  }
  if (options.probe) throw new Error("Probe found no matching Anthropic Environment");

  const environment = await anthropicRequest(key, "POST", "/v1/environments", {
    name: `Paperclip · ${options.displayName}`,
    description: "Paperclip remote-agent environment: no network or added packages.",
    config: {
      type: "cloud",
      networking: {
        type: "limited",
        allow_mcp_servers: false,
        allow_package_managers: false,
        allowed_hosts: [],
      },
      packages: {
        apt: [],
        cargo: [],
        gem: [],
        go: [],
        npm: [],

View on GitHub (pinned to 5716fe907e)

Solutions

  1. Run the command without --probe once so Paperclip creates the Environment, then use --probe afterwards.
  2. Pass --environment-id with the ID of the existing environment you want to reuse.
  3. Verify the ANTHROPIC API key belongs to the workspace that contains the environment (list GET /v1/environments to confirm).
  4. If the environment was deleted, recreate it via a non-probe run.

Example fix

// before (fails in dry-run on a fresh workspace)
cli managed-agent environment --probe
// after (provision, then probe)
cli managed-agent environment      # creates the Environment
cli managed-agent environment --probe   # now passes
Defensive patterns

Strategy: validation

Validate before calling

// before probing, confirm the environment exists for this profile
const envs = await listAll(key, "/v1/environments");
const match = resourceByProfile(envs, profileKey, "Environment");
if (!match && probeOnly) throw new SkipProbeError("no environment for profile " + profileKey);

Type guard

function hasId(r: unknown): r is Record<string, unknown> & { id: string } {
  return typeof r === "object" && r !== null && typeof (r as any).id === "string" && (r as any).id.length > 0;
}

Try / catch

try {
  await resolveEnvironment(key, { ...opts, probe: true });
} catch (e) {
  if (e instanceof Error && e.message.includes("Probe found no matching")) {
    await resolveEnvironment(key, { ...opts, probe: false }); // provision then re-probe later
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the `environment` or `agent` CLI command with --probe (or options.probe=true) when no environmentId is given and no existing /v1/environments entry carries the profile's paperclip_profile metadata matching options.profileKey.

Common situations: Pre-flight validation against a fresh Anthropic account/workspace before the first real setup; pointing the CLI at a different API key or workspace than the one where the environment was created; the environment having been deleted or its metadata changed.

Related errors


AI-assisted analysis of paperclipai/paperclip@5716fe907e (2026-09-02). Data as JSON: /api/errors/0c1805bb01578e1b. Report an issue: GitHub.