{"record":{"id":"802c151f37d07237","repo":"paperclipai/paperclip","slug":"secret-create-returned-no-data-for-candidate-sec","errorCode":null,"errorMessage":"Secret create returned no data for ${candidate.secretName}","messagePattern":"Secret create returned no data for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/secrets.ts","lineNumber":330,"sourceCode":"    const agent = agents.find((row) => row.id === candidate.agentId);\n    const env = asRecord(agent?.adapterConfig.env);\n    const value = env ? toPlainEnvValue(env[candidate.envKey]) : null;\n    if (!value) continue;\n\n    if (candidate.existingSecretId) {\n      await ctx.api.post(apiPath`/api/secrets/${candidate.existingSecretId}/rotate`, { value });\n      createdOrRotated.set(`${candidate.agentId}:${candidate.envKey}`, candidate.existingSecretId);\n      rotatedSecrets += 1;\n      continue;\n    }\n\n    const created = await ctx.api.post<CompanySecret>(apiPath`/api/companies/${companyId}/secrets`, {\n      name: candidate.secretName,\n      provider: \"local_encrypted\",\n      value,\n      description: `Migrated from agent ${candidate.agentId} env ${candidate.envKey}`,\n    });\n    if (!created) throw new Error(`Secret create returned no data for ${candidate.secretName}`);\n    createdOrRotated.set(`${candidate.agentId}:${candidate.envKey}`, created.id);\n    createdSecrets += 1;\n  }\n\n  let updatedAgents = 0;\n  for (const agent of agents) {\n    const env = asRecord(agent.adapterConfig.env);\n    if (!env) continue;\n    const secretIdByEnvKey = new Map<string, string>();\n    for (const [key] of Object.entries(env)) {\n      const secretId = createdOrRotated.get(`${agent.id}:${key}`);\n      if (secretId) secretIdByEnvKey.set(key, secretId);\n    }\n    if (secretIdByEnvKey.size === 0) continue;\n    const adapterConfig = {\n      ...agent.adapterConfig,\n      env: buildMigratedAgentEnv(env, secretIdByEnvKey),\n    };","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/secrets.ts#L312-L348","documentation":"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.","triggerScenarios":"Thrown at cli/src/commands/client/secrets.ts:330 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the create; if it persists, check server logs and that the secret name is valid."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}