paperclipai/paperclip · error

Secret create returned no data for

Error message

Secret create returned no data for ${candidate.secretName}

What it means

migrateInlineEnv posted a secret create for a migrated env binding and got a falsy response, so the new secret id is unavailable and migration cannot record it; a sentinel guard on the API result.

Solutions

  1. Retry the create; if it persists, check server logs and that the secret name is valid.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at cli/src/commands/client/secrets.ts:330 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/802c151f37d07237. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/commands/client/secrets.ts:330

    const agent = agents.find((row) => row.id === candidate.agentId);
    const env = asRecord(agent?.adapterConfig.env);
    const value = env ? toPlainEnvValue(env[candidate.envKey]) : null;
    if (!value) continue;

    if (candidate.existingSecretId) {
      await ctx.api.post(apiPath`/api/secrets/${candidate.existingSecretId}/rotate`, { value });
      createdOrRotated.set(`${candidate.agentId}:${candidate.envKey}`, candidate.existingSecretId);
      rotatedSecrets += 1;
      continue;
    }

    const created = await ctx.api.post<CompanySecret>(apiPath`/api/companies/${companyId}/secrets`, {
      name: candidate.secretName,
      provider: "local_encrypted",
      value,
      description: `Migrated from agent ${candidate.agentId} env ${candidate.envKey}`,
    });
    if (!created) throw new Error(`Secret create returned no data for ${candidate.secretName}`);
    createdOrRotated.set(`${candidate.agentId}:${candidate.envKey}`, created.id);
    createdSecrets += 1;
  }

  let updatedAgents = 0;
  for (const agent of agents) {
    const env = asRecord(agent.adapterConfig.env);
    if (!env) continue;
    const secretIdByEnvKey = new Map<string, string>();
    for (const [key] of Object.entries(env)) {
      const secretId = createdOrRotated.get(`${agent.id}:${key}`);
      if (secretId) secretIdByEnvKey.set(key, secretId);
    }
    if (secretIdByEnvKey.size === 0) continue;
    const adapterConfig = {
      ...agent.adapterConfig,
      env: buildMigratedAgentEnv(env, secretIdByEnvKey),
    };

View on GitHub (pinned to 120ae5428f)