Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: updated bot not found error message

=1f6c33bdb87e
diff --git a/backend/src/services/project-bot/project-bot-fns.ts b/backend/src/services/project-bot/project-bot-fns.ts
index 00604b37fd..0f5d229d74 100644
--- a/backend/src/services/project-bot/project-bot-fns.ts
+++ b/backend/src/services/project-bot/project-bot-fns.ts
@@ -24,10 +24,10 @@ export const getBotKeyFnFactory = (
const bot = await projectBotDAL.findOne({ projectId: project.id });
- if (!bot) throw new BadRequestError({ message: "Failed to find bot key" });
- if (!bot.isActive) throw new BadRequestError({ message: "Bot is not active" });
+ if (!bot) throw new BadRequestError({ message: "Failed to find bot key", name: "bot_not_found_error" });
+ if (!bot.isActive) throw new BadRequestError({ message: "Bot is not active", name: "bot_not_found_error" });
if (!bot.encryptedProjectKeyNonce || !bot.encryptedProjectKey)
- throw new BadRequestError({ message: "Encryption key missing" });
+ throw new BadRequestError({ message: "Encryption key missing", name: "bot_not_found_error" });
const botPrivateKey = getBotPrivateKey({ bot });
diff --git a/cli/packages/api/api.go b/cli/packages/api/api.go
index 3aa07ad6f6..c7827cdc93 100644
--- a/cli/packages/api/api.go
+++ b/cli/packages/api/api.go
@@ -418,7 +418,10 @@ func CallGetRawSecretsV3(httpClient *resty.Client, request GetRawSecretsV3Reques
}
if response.IsError() && strings.Contains(response.String(), "bot_not_found_error") {
- return GetRawSecretsV3Response{}, fmt.Errorf("project with id %s is a legacy project type, please navigate to project settings and disable end to end encryption then try again", request.WorkspaceId)
+ return GetRawSecretsV3Response{}, fmt.Errorf(`project with id %s is a legacy project type,
+ Legacy infisical instance: Please disable end to end encryption inside project settings.
+ New infisical instances/cloud: Please upgrade your project by navigating to secret overview page and click on upgrade.
+ `, request.WorkspaceId)
}
if response.IsError() {
diff --git a/cli/packages/util/secrets.go b/cli/packages/util/secrets.go
index ec98a181f1..18608c61e3 100644
--- a/cli/packages/util/secrets.go
+++ b/cli/packages/util/secrets.go
@@ -250,15 +250,16 @@ func GetAllEnvironmentVariables(params models.GetAllSecretsParameters, projectCo
infisicalDotJson.WorkspaceId = params.WorkspaceId
}
- res, errorToReturn := GetPlainTextSecretsV3(loggedInUserDetails.UserCredentials.JTWToken, infisicalDotJson.WorkspaceId,
+ res, err := GetPlainTextSecretsV3(loggedInUserDetails.UserCredentials.JTWToken, infisicalDotJson.WorkspaceId,
params.Environment, params.SecretsPath, params.IncludeImport, params.Recursive)
- log.Debug().Msgf("GetAllEnvironmentVariables: Trying to fetch secrets JTW token [err=%s]", errorToReturn)
+ log.Debug().Msgf("GetAllEnvironmentVariables: Trying to fetch secrets JTW token [err=%s]", err)
- if errorToReturn == nil {
+ if err == nil {
WriteBackupSecrets(infisicalDotJson.WorkspaceId, params.Environment, params.SecretsPath, res.Secrets)
}
secretsToReturn = res.Secrets
+ errorToReturn = err
// only attempt to serve cached secrets if no internet connection and if at least one secret cached
if !isConnected {
backedSecrets, err := ReadBackupSecrets(infisicalDotJson.WorkspaceId, params.Environment, params.SecretsPath)