From a3db732fe2f46dbe7e07d32c3a002f91645229ca Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 2 Jun 2026 13:41:03 -0700 Subject: [PATCH 1/4] chore: sort slackerror constants and ErrorCodeMap alphabetically Co-Authored-By: Claude --- internal/slackerror/errors.go | 525 +++++++++++++++++----------------- 1 file changed, 261 insertions(+), 264 deletions(-) diff --git a/internal/slackerror/errors.go b/internal/slackerror/errors.go index c446eb78..0da15608 100644 --- a/internal/slackerror/errors.go +++ b/internal/slackerror/errors.go @@ -27,7 +27,6 @@ const ( ErrAddAppToProject = "add_app_to_project_error" ErrAlreadyLoggedOut = "already_logged_out" ErrAlreadyResolved = "already_resolved" - ErrAppsList = "apps_list_error" ErrAppAdd = "app_add_error" ErrAppApprovalRequestDenied = "app_approval_request_denied" ErrAppApprovalRequestEligible = "app_approval_request_eligible" @@ -37,8 +36,8 @@ const ( ErrAppDelete = "app_delete_error" ErrAppDeploy = "app_deploy_error" ErrAppDeployNotSlackHosted = "app_deploy_function_runtime_not_slack" - ErrAppDirectoryAccess = "app_directory_access_error" ErrAppDirOnlyFail = "app_dir_only_fail" + ErrAppDirectoryAccess = "app_directory_access_error" ErrAppExists = "app_add_exists" ErrAppFlagRequired = "app_flag_required" ErrAppFound = "app_found" @@ -50,17 +49,23 @@ const ( ErrAppManifestUpdate = "app_manifest_update_error" ErrAppManifestValidate = "app_manifest_validate_error" ErrAppNotEligible = "app_not_eligible" - ErrAppNotInstalled = "app_not_installed" ErrAppNotFound = "app_not_found" ErrAppNotHosted = "app_not_hosted" + ErrAppNotInstalled = "app_not_installed" ErrAppRemove = "app_remove_error" ErrAppRenameApp = "app_rename_app" + ErrAppsList = "apps_list_error" ErrAtActiveSandboxLimit = "at_active_sandbox_limit" // Slack API error code ErrAuthProdTokenNotFound = "auth_prod_token_not_found" ErrAuthTimeout = "auth_timeout_error" ErrAuthToken = "auth_token_error" ErrAuthVerification = "auth_verification_error" ErrBotInviteRequired = "bot_invite_required" // Slack API error code + ErrCLIAutoUpdate = "cli_autoupdate_error" + ErrCLIConfigInvalid = "cli_config_invalid" + ErrCLIConfigLocationError = "cli_config_location_error" + ErrCLIReadError = "cli_read_error" + ErrCLIUpdateRequired = "cli_update_required" // Slack API error code ErrCannotAbandonApp = "cannot_abandon_app" ErrCannotAddOwner = "cannot_add_owner" ErrCannotCountOwners = "cannot_count_owners" @@ -70,25 +75,20 @@ const ( ErrCannotRemoveCollaborators = "cannot_remove_collaborators" ErrCannotRemoveOwners = "cannot_remove_owner" ErrCannotRevokeOrgBotToken = "cannot_revoke_org_bot_token" - ErrConnectorApprovalPending = "connector_approval_pending" - ErrConnectorApprovalRequired = "connector_approval_required" - ErrConnectorDenied = "connector_denied" - ErrConnectorNotInstalled = "connector_not_installed" ErrChannelNotFound = "channel_not_found" - ErrCLIAutoUpdate = "cli_autoupdate_error" - ErrCLIConfigLocationError = "cli_config_location_error" - ErrCLIConfigInvalid = "cli_config_invalid" - ErrCLIReadError = "cli_read_error" - ErrCLIUpdateRequired = "cli_update_required" // Slack API error code ErrCommentRequired = "comment_required" ErrConnectedOrgDenied = "connected_org_denied" ErrConnectedTeamDenied = "connected_team_denied" + ErrConnectorApprovalPending = "connector_approval_pending" + ErrConnectorApprovalRequired = "connector_approval_required" + ErrConnectorDenied = "connector_denied" + ErrConnectorNotInstalled = "connector_not_installed" ErrContextValueNotFound = "context_value_not_found" ErrCredentialsNotFound = "credentials_not_found" ErrCustomizableInputMissingMatchingWorkflowInput = "customizable_input_missing_matching_workflow_input" + ErrCustomizableInputUnsupportedType = "customizable_input_unsupported_type" ErrCustomizableInputsNotAllowedOnOptionalInputs = "customizable_inputs_not_allowed_on_optional_inputs" ErrCustomizableInputsOnlyAllowedOnLinkTriggers = "customizable_inputs_only_allowed_on_link_triggers" - ErrCustomizableInputUnsupportedType = "customizable_input_unsupported_type" ErrDatastore = "datastore_error" ErrDatastoreMissingPrimaryKey = "datastore_missing_primary_key" ErrDatastoreNotFound = "datastore_not_found" @@ -104,14 +104,14 @@ const ( ErrDotEnvPlaceholderNotFound = "dotenv_placeholder_not_found" ErrDotEnvVarMarshal = "dotenv_var_marshal_error" ErrEnterpriseNotFound = "enterprise_not_found" + ErrFailForSomeRequests = "failed_for_some_requests" + ErrFailToGetTeamsForRestrictedUser = "fail_to_get_teams_for_restricted_user" ErrFailedAddingCollaborator = "failed_adding_collaborator" ErrFailedCreatingApp = "failed_creating_app" ErrFailedDatastoreOperation = "failed_datastore_operation" ErrFailedExport = "failed_export" - ErrFailForSomeRequests = "failed_for_some_requests" ErrFailedToGetUser = "failed_to_get_user" ErrFailedToSaveExtensionLogs = "failed_to_save_extension_logs" - ErrFailToGetTeamsForRestrictedUser = "fail_to_get_teams_for_restricted_user" ErrFeedbackNameInvalid = "feedback_name_invalid" ErrFeedbackNameRequired = "feedback_name_required" ErrFileRejected = "file_rejected" @@ -119,14 +119,14 @@ const ( ErrFreeTeamNotAllowed = "free_team_not_allowed" ErrFunctionBelongsToAnotherApp = "function_belongs_to_another_app" ErrFunctionNotFound = "function_not_found" - ErrGitNotFound = "git_not_found" ErrGitClone = "git_clone_error" + ErrGitNotFound = "git_not_found" ErrGitZipDownload = "git_zip_download_error" + ErrHTTPRequestFailed = "http_request_failed" + ErrHTTPResponseInvalid = "http_response_invalid" ErrHomeDirectoryAccessFailed = "home_directory_access_failed" ErrHooksJSONLocation = "hooks_json_location_error" ErrHostAppsDisallowUserScopes = "hosted_apps_disallow_user_scopes" - ErrHTTPRequestFailed = "http_request_failed" - ErrHTTPResponseInvalid = "http_response_invalid" ErrInsecureRequest = "insecure_request" ErrInstallationDenied = "installation_denied" ErrInstallationFailed = "installation_failed" @@ -137,12 +137,14 @@ const ( ErrInvalidAppFlag = "invalid_app_flag" ErrInvalidAppID = "invalid_app_id" ErrInvalidArgs = "invalid_args" - ErrInvalidArgumentsCustomizableInputs = "invalid_arguments_customizable_inputs" ErrInvalidArguments = "invalid_arguments" + ErrInvalidArgumentsCustomizableInputs = "invalid_arguments_customizable_inputs" ErrInvalidAuth = "invalid_auth" ErrInvalidChallenge = "invalid_challenge" ErrInvalidChannelID = "invalid_channel_id" ErrInvalidCursor = "invalid_cursor" + ErrInvalidDatastore = "invalid_datastore" + ErrInvalidDatastoreExpression = "invalid_datastore_expression" ErrInvalidDistributionType = "invalid_distribution_type" ErrInvalidFlag = "invalid_flag" ErrInvalidInteractiveTriggerInputs = "invalid_interactive_trigger_inputs" @@ -155,12 +157,12 @@ const ( ErrInvalidResourceID = "invalid_resource_id" ErrInvalidResourceType = "invalid_resource_type" ErrInvalidS3Key = "invalid_s3_key" - ErrInvalidSandboxArchiveTTL = "invalid_archive_ttl" // Slack API error code + ErrInvalidSandboxArchiveTTL = "invalid_archive_ttl" // Slack API error code + ErrInvalidSandboxTeamID = "invalid_sandbox_team_id" // Slack API error code + ErrInvalidSandboxTemplateID = "invalid_template_id" ErrInvalidScopes = "invalid_scopes" ErrInvalidSemVer = "invalid_semver" ErrInvalidSlackProjectDirectory = "invalid_slack_project_directory" - ErrInvalidDatastore = "invalid_datastore" - ErrInvalidDatastoreExpression = "invalid_datastore_expression" ErrInvalidToken = "invalid_token" ErrInvalidTrigger = "invalid_trigger" ErrInvalidTriggerAccess = "invalid_trigger_access" @@ -168,8 +170,6 @@ const ( ErrInvalidTriggerEventType = "invalid_trigger_event_type" ErrInvalidTriggerInputs = "invalid_trigger_inputs" ErrInvalidTriggerType = "invalid_trigger_type" - ErrInvalidSandboxTemplateID = "invalid_template_id" - ErrInvalidSandboxTeamID = "invalid_sandbox_team_id" // Slack API error code ErrInvalidUserID = "invalid_user_id" ErrInvalidWebhookConfig = "invalid_webhook_config" ErrInvalidWebhookSchemaRef = "invalid_webhook_schema_ref" @@ -187,17 +187,14 @@ const ( ErrMissingAppTeamID = "missing_app_team_id" ErrMissingChallenge = "missing_challenge" ErrMissingExperiment = "missing_experiment" - ErrMissingFunctionIdentifier = "missing_function_identifier" ErrMissingFlag = "missing_flag" + ErrMissingFunctionIdentifier = "missing_function_identifier" ErrMissingInput = "missing_input" ErrMissingOptions = "missing_options" ErrMissingScope = "missing_scope" ErrMissingScopes = "missing_scopes" ErrMissingUser = "missing_user" ErrMissingValue = "missing_value" - ErrNotAuthed = "not_authed" - ErrNotBearerToken = "not_bearer_token" - ErrNotFound = "not_found" ErrNoAppSelected = "no_app_selected" ErrNoFile = "no_file" ErrNoPendingRequest = "no_pending_request" @@ -205,10 +202,13 @@ const ( ErrNoTokenFound = "no_token_found" ErrNoTriggers = "no_triggers" ErrNoValidNamedEntities = "no_valid_named_entities" + ErrNotAuthed = "not_authed" + ErrNotBearerToken = "not_bearer_token" + ErrNotFound = "not_found" + ErrOSNotSupported = "os_not_supported" + ErrOrgGrantExists = "org_grant_exists" ErrOrgNotConnected = "org_not_connected" ErrOrgNotFound = "org_not_found" - ErrOrgGrantExists = "org_grant_exists" - ErrOSNotSupported = "os_not_supported" ErrOverResourceLimit = "over_resource_limit" ErrParameterValidationFailed = "parameter_validation_failed" ErrProcessInterrupted = "process_interrupted" @@ -216,27 +216,27 @@ const ( ErrProjectConfigIDNotFound = "project_config_id_not_found" ErrProjectConfigManifestSource = "project_config_manifest_source_error" ErrProjectFileUpdate = "project_file_update_error" - ErrProviderNotFound = "provider_not_found" ErrPrompt = "prompt_error" + ErrProviderNotFound = "provider_not_found" ErrPublishedAppOnly = "published_app_only" - ErrRequestIDOrAppIDIsRequired = "request_id_or_app_id_is_required" ErrRatelimited = "ratelimited" + ErrRequestIDOrAppIDIsRequired = "request_id_or_app_id_is_required" ErrRestrictedPlanLevel = "restricted_plan_level" ErrRuntimeNotFound = "runtime_not_found" ErrRuntimeNotSupported = "runtime_not_supported" - ErrSandboxDomainTaken = "domain_taken" // Slack API error code - ErrSandboxDomainTooLong = "domain_long" // Slack API error code ErrSDKConfigLoad = "sdk_config_load_error" ErrSDKHookInvocationFailed = "sdk_hook_invocation_failed" ErrSDKHookNotFound = "sdk_hook_not_found" ErrSampleCreate = "sample_create_error" + ErrSandboxDomainTaken = "domain_taken" // Slack API error code + ErrSandboxDomainTooLong = "domain_long" // Slack API error code + ErrScopesExceedAppConfig = "scopes_exceed_app_config" ErrServiceLimitsExceeded = "service_limits_exceeded" ErrSharedChannelDenied = "shared_channel_denied" ErrSlackAuth = "slack_auth_error" ErrSlackJSONLocation = "slack_json_location_error" ErrSlackSlackJSONLocation = "slack_slack_json_location_error" ErrSocketConnection = "socket_connection_error" - ErrScopesExceedAppConfig = "scopes_exceed_app_config" ErrStreamingActivityLogs = "streaming_activity_logs_error" ErrSubdirNotFound = "subdir_not_found" ErrSurveyConfigNotFound = "survey_config_not_found" @@ -270,8 +270,8 @@ const ( ErrUnknownMethod = "unknown_method" ErrUnknownWebhookSchemaRef = "unknown_webhook_schema_ref" ErrUnknownWorkflowID = "unknown_workflow_id" - ErrUntrustedSource = "untrusted_source" ErrUnsupportedFileName = "unsupported_file_name" + ErrUntrustedSource = "untrusted_source" ErrUserAlreadyOwner = "user_already_owner" ErrUserAlreadyRequested = "user_already_requested" ErrUserCannotManageApp = "user_cannot_manage_app" @@ -305,11 +305,6 @@ var ErrorCodeMap = map[string]Error{ Message: "The app already has a resolution and cannot be requested", }, - ErrAppsList: { - Code: ErrAppsList, - Message: "Couldn't get a list of your apps", - }, - ErrAppAdd: { Code: ErrAppAdd, Message: "Couldn't create a new app", @@ -360,27 +355,24 @@ var ErrorCodeMap = map[string]Error{ ErrorDetail{Message: "Deployment to Slack is currently supported for apps written with the Deno Slack SDK."}, }, Remediation: fmt.Sprintf(`Learn about building apps with the Deno Slack SDK: - https://docs.slack.dev/tools/deno-slack-sdk - If you are using a Bolt framework, add a deploy hook then run: %s - Otherwise start your app for local development with: %s`, style.Commandf("deploy", true), style.Commandf("run", true), ), }, - ErrAppDirectoryAccess: { - Code: ErrAppDirectoryAccess, - Message: "Couldn't access app directory", - }, - ErrAppDirOnlyFail: { Code: ErrAppDirOnlyFail, Message: "The app was neither in the app directory nor created on this team/org, and cannot be requested", }, + ErrAppDirectoryAccess: { + Code: ErrAppDirectoryAccess, + Message: "Couldn't access app directory", + }, + ErrAppExists: { Code: ErrAppExists, Message: "App already exists belonging to the team", @@ -438,11 +430,6 @@ Otherwise start your app for local development with: %s`, Message: "The specified app is not eligible for this API", }, - ErrAppNotInstalled: { - Code: ErrAppNotInstalled, - Message: "The provided app must be installed on this team", - }, - ErrAppNotFound: { Code: ErrAppNotFound, Message: "The app was not found", @@ -457,6 +444,11 @@ Otherwise start your app for local development with: %s`, }, "\n"), }, + ErrAppNotInstalled: { + Code: ErrAppNotInstalled, + Message: "The provided app must be installed on this team", + }, + ErrAppRemove: { Code: ErrAppRemove, Message: "Couldn't remove your app", @@ -467,6 +459,11 @@ Otherwise start your app for local development with: %s`, Message: "Couldn't rename your app", }, + ErrAppsList: { + Code: ErrAppsList, + Message: "Couldn't get a list of your apps", + }, + ErrAtActiveSandboxLimit: { Code: ErrAtActiveSandboxLimit, Message: "You've reached the maximum number of active sandboxes", @@ -492,54 +489,63 @@ Otherwise start your app for local development with: %s`, Message: "Couldn't get a token with an active session", }, - ErrCannotAbandonApp: { - Code: ErrCannotAbandonApp, - Message: "The last owner cannot be removed", + ErrAuthVerification: { + Code: ErrAuthVerification, + Message: "Couldn't verify your authorization", }, - ErrCannotAddOwner: { - Code: ErrCannotAddOwner, - Message: "Unable to add the given user as owner", + ErrBotInviteRequired: { + Code: ErrBotInviteRequired, + Message: "Your app must be invited to the channel", + Remediation: "Try to find the channel declared the source code of a workflow or function.\n\nOpen Slack, join the channel, invite your app, and try the command again.\nLearn more: https://slack.com/help/articles/201980108-Add-people-to-a-channel", }, - ErrCannotCountOwners: { - Code: ErrCannotCountOwners, - Message: "Unable to retrieve current app collaborators", + ErrCLIAutoUpdate: { + Code: ErrCLIAutoUpdate, + Message: "Couldn't auto-update this command-line tool", + Remediation: "You can manually install the latest version from:\nhttps://docs.slack.dev/tools/slack-cli", }, - ErrConnectorApprovalPending: { - Code: ErrConnectorApprovalPending, - Message: "A connector requires admin approval before it can be installed\nApproval is pending review", - Remediation: "Contact your Slack admin about the status of your request", + ErrCLIConfigInvalid: { + Code: ErrCLIConfigInvalid, + Message: "Configuration invalid", + Remediation: "Check your config.json file.", }, - ErrConnectorApprovalRequired: { - Code: ErrConnectorApprovalRequired, - Message: "A connector requires admin approval before it can be installed", - Remediation: "Request approval for the given connector from your Slack admin", + ErrCLIConfigLocationError: { + Code: ErrCLIConfigLocationError, + Message: fmt.Sprintf("The %s configuration file is not supported", filepath.Join(".slack", "cli.json")), + Remediation: strings.Join([]string{ + "This version of the CLI no longer supports this configuration file.", + fmt.Sprintf("Move the %s file to %s and try again.", filepath.Join(".slack", "cli.json"), filepath.Join(".slack", "hooks.json")), + }, "\n"), }, - ErrConnectorDenied: { - Code: ErrConnectorDenied, - Message: "A connector has been denied for use by an admin", - Remediation: "Contact your Slack admin", + ErrCLIReadError: { + Code: ErrCLIReadError, + Message: "There was an error reading configuration", + Remediation: "Check your config.json file.", }, - ErrConnectorNotInstalled: { - Code: ErrConnectorNotInstalled, - Message: "A connector requires installation before it can be used", - Remediation: "Request installation for the given connector", + ErrCLIUpdateRequired: { + Code: ErrCLIUpdateRequired, + Message: "Slack API requires the latest version of the Slack CLI", + Remediation: fmt.Sprintf("You can upgrade to the latest version of the Slack CLI using the command: %s", style.Commandf("upgrade", false)), }, - ErrAuthVerification: { - Code: ErrAuthVerification, - Message: "Couldn't verify your authorization", + ErrCannotAbandonApp: { + Code: ErrCannotAbandonApp, + Message: "The last owner cannot be removed", }, - ErrBotInviteRequired: { - Code: ErrBotInviteRequired, - Message: "Your app must be invited to the channel", - Remediation: "Try to find the channel declared the source code of a workflow or function.\n\nOpen Slack, join the channel, invite your app, and try the command again.\nLearn more: https://slack.com/help/articles/201980108-Add-people-to-a-channel", + ErrCannotAddOwner: { + Code: ErrCannotAddOwner, + Message: "Unable to add the given user as owner", + }, + + ErrCannotCountOwners: { + Code: ErrCannotCountOwners, + Message: "Unable to retrieve current app collaborators", }, ErrCannotDeleteApp: { @@ -578,52 +584,43 @@ Otherwise start your app for local development with: %s`, Remediation: "Try adding your app as a member to the channel.", }, - ErrCLIAutoUpdate: { - Code: ErrCLIAutoUpdate, - Message: "Couldn't auto-update this command-line tool", - Remediation: "You can manually install the latest version from:\nhttps://docs.slack.dev/tools/slack-cli", - }, - - ErrCLIConfigLocationError: { - Code: ErrCLIConfigLocationError, - Message: fmt.Sprintf("The %s configuration file is not supported", filepath.Join(".slack", "cli.json")), - Remediation: strings.Join([]string{ - "This version of the CLI no longer supports this configuration file.", - fmt.Sprintf("Move the %s file to %s and try again.", filepath.Join(".slack", "cli.json"), filepath.Join(".slack", "hooks.json")), - }, "\n"), + ErrCommentRequired: { + Code: ErrCommentRequired, + Message: "Your admin is requesting a reason to approve installation of this app", }, - ErrCLIReadError: { - Code: ErrCLIReadError, - Message: "There was an error reading configuration", - Remediation: "Check your config.json file.", + ErrConnectedOrgDenied: { + Code: ErrConnectedOrgDenied, + Message: "The admin does not allow connected organizations to be named_entities", }, - ErrCLIConfigInvalid: { - Code: ErrCLIConfigInvalid, - Message: "Configuration invalid", - Remediation: "Check your config.json file.", + ErrConnectedTeamDenied: { + Code: ErrConnectedTeamDenied, + Message: "The admin does not allow connected teams to be named_entities", }, - ErrCLIUpdateRequired: { - Code: ErrCLIUpdateRequired, - Message: "Slack API requires the latest version of the Slack CLI", - Remediation: fmt.Sprintf("You can upgrade to the latest version of the Slack CLI using the command: %s", style.Commandf("upgrade", false)), + ErrConnectorApprovalPending: { + Code: ErrConnectorApprovalPending, + Message: "A connector requires admin approval before it can be installed\nApproval is pending review", + Remediation: "Contact your Slack admin about the status of your request", }, - ErrConnectedOrgDenied: { - Code: ErrConnectedOrgDenied, - Message: "The admin does not allow connected organizations to be named_entities", + ErrConnectorApprovalRequired: { + Code: ErrConnectorApprovalRequired, + Message: "A connector requires admin approval before it can be installed", + Remediation: "Request approval for the given connector from your Slack admin", }, - ErrCommentRequired: { - Code: ErrCommentRequired, - Message: "Your admin is requesting a reason to approve installation of this app", + ErrConnectorDenied: { + Code: ErrConnectorDenied, + Message: "A connector has been denied for use by an admin", + Remediation: "Contact your Slack admin", }, - ErrConnectedTeamDenied: { - Code: ErrConnectedTeamDenied, - Message: "The admin does not allow connected teams to be named_entities", + ErrConnectorNotInstalled: { + Code: ErrConnectorNotInstalled, + Message: "A connector requires installation before it can be used", + Remediation: "Request installation for the given connector", }, ErrContextValueNotFound: { @@ -642,6 +639,11 @@ Otherwise start your app for local development with: %s`, Message: "Customizable input on the trigger must map to a workflow input of the same name", }, + ErrCustomizableInputUnsupportedType: { + Code: ErrCustomizableInputUnsupportedType, + Message: "Customizable input has been mapped to a workflow input of an unsupported type. Only `UserID`, `ChannelId`, and `String` are supported for customizable inputs", + }, + ErrCustomizableInputsNotAllowedOnOptionalInputs: { Code: ErrCustomizableInputsNotAllowedOnOptionalInputs, Message: "Customizable trigger inputs must map to required workflow inputs", @@ -652,11 +654,6 @@ Otherwise start your app for local development with: %s`, Message: "Customizable inputs are only allowed on link triggers", }, - ErrCustomizableInputUnsupportedType: { - Code: ErrCustomizableInputUnsupportedType, - Message: "Customizable input has been mapped to a workflow input of an unsupported type. Only `UserID`, `ChannelId`, and `String` are supported for customizable inputs", - }, - ErrDatastore: { Code: ErrDatastore, Message: "An error occurred while accessing your datastore", @@ -733,6 +730,16 @@ Otherwise start your app for local development with: %s`, Message: "The `enterprise` was not found", }, + ErrFailForSomeRequests: { + Code: ErrFailForSomeRequests, + Message: "At least one request was not cancelled", + }, + + ErrFailToGetTeamsForRestrictedUser: { + Code: ErrFailToGetTeamsForRestrictedUser, + Message: "Failed to get teams for restricted user", + }, + ErrFailedAddingCollaborator: { Code: ErrFailedAddingCollaborator, Message: "Failed writing a collaborator record for this new app", @@ -754,11 +761,6 @@ Otherwise start your app for local development with: %s`, Message: "Couldn't export the app manifest", }, - ErrFailForSomeRequests: { - Code: ErrFailForSomeRequests, - Message: "At least one request was not cancelled", - }, - ErrFailedToGetUser: { Code: ErrFailedToGetUser, Message: "Couldn't find the user to install the app", @@ -769,11 +771,6 @@ Otherwise start your app for local development with: %s`, Message: "Couldn't save the logs", }, - ErrFailToGetTeamsForRestrictedUser: { - Code: ErrFailToGetTeamsForRestrictedUser, - Message: "Failed to get teams for restricted user", - }, - ErrFeedbackNameInvalid: { Code: ErrFeedbackNameInvalid, Message: "The name of the feedback is invalid", @@ -815,22 +812,32 @@ Otherwise start your app for local development with: %s`, Message: "The specified function couldn't be found", }, + ErrGitClone: { + Code: ErrGitClone, + Message: "Git failed to clone repository", + }, + ErrGitNotFound: { Code: ErrGitNotFound, Message: "Couldn't find Git installed on this system", Remediation: "To install Git, visit https://github.com/git-guides/install-git.", }, - ErrGitClone: { - Code: ErrGitClone, - Message: "Git failed to clone repository", - }, - ErrGitZipDownload: { Code: ErrGitZipDownload, Message: "Cannot download Git repository as a .zip archive", }, + ErrHTTPRequestFailed: { + Code: ErrHTTPRequestFailed, + Message: "HTTP request failed", + }, + + ErrHTTPResponseInvalid: { + Code: ErrHTTPResponseInvalid, + Message: "Received an invalid response from the server", + }, + ErrHomeDirectoryAccessFailed: { Code: ErrHomeDirectoryAccessFailed, Message: "Failed to read/create .slack/ directory in your home directory", @@ -848,16 +855,6 @@ Otherwise start your app for local development with: %s`, Message: "Hosted apps do not support user scopes", }, - ErrHTTPRequestFailed: { - Code: ErrHTTPRequestFailed, - Message: "HTTP request failed", - }, - - ErrHTTPResponseInvalid: { - Code: ErrHTTPResponseInvalid, - Message: "Received an invalid response from the server", - }, - ErrInsecureRequest: { Code: ErrInsecureRequest, Message: "The method was not called via a `POST` request", @@ -918,16 +915,16 @@ Otherwise start your app for local development with: %s`, Message: "Required arguments either were not provided or contain invalid values", }, - ErrInvalidArgumentsCustomizableInputs: { - Code: ErrInvalidArgumentsCustomizableInputs, - Message: "A trigger input parameter with customizable: true cannot be set as hidden or locked, nor have a value provided at trigger creation time", - }, - ErrInvalidArguments: { Code: ErrInvalidArguments, Message: "Slack API request parameters are invalid", }, + ErrInvalidArgumentsCustomizableInputs: { + Code: ErrInvalidArgumentsCustomizableInputs, + Message: "A trigger input parameter with customizable: true cannot be set as hidden or locked, nor have a value provided at trigger creation time", + }, + ErrInvalidAuth: { Code: ErrInvalidAuth, Message: "Your user account authorization isn't valid", @@ -954,9 +951,18 @@ Otherwise start your app for local development with: %s`, Message: "Value passed for `cursor` was not valid or is valid no longer", }, - ErrInvalidFlag: { - Code: ErrInvalidFlag, - Message: "The provided flag value is invalid", + ErrInvalidDatastore: { + Code: ErrInvalidDatastore, + Message: "Invalid datastore specified in your project", + }, + + ErrInvalidDatastoreExpression: { + Code: ErrInvalidDatastoreExpression, + Message: "The provided expression is not valid", + Remediation: strings.Join([]string{ + "Verify the expression you provided is valid JSON surrounded by quotations", + fmt.Sprintf("Use %s for examples", style.Commandf("datastore --help", false)), + }, "\n"), }, ErrInvalidDistributionType: { @@ -964,6 +970,11 @@ Otherwise start your app for local development with: %s`, Message: "This function requires distribution_type to be set as named_entities before adding users", }, + ErrInvalidFlag: { + Code: ErrInvalidFlag, + Message: "The provided flag value is invalid", + }, + ErrInvalidInteractiveTriggerInputs: { Code: ErrInvalidInteractiveTriggerInputs, Message: "One or more input parameter types isn't supported by the link trigger type", @@ -1025,6 +1036,17 @@ Otherwise start your app for local development with: %s`, Remediation: "Use days (1d), weeks (2w), or months (3mo); min 1d, max 6mo", }, + ErrInvalidSandboxTeamID: { + Code: ErrInvalidSandboxTeamID, + Message: "The provided sandbox team ID is invalid", + Remediation: fmt.Sprintf("List your sandboxes with the %s command to find the ID", style.Commandf("sandbox list", false)), + }, + + ErrInvalidSandboxTemplateID: { + Code: ErrInvalidSandboxTemplateID, + Message: "The provided sandbox template value is invalid", + }, + ErrInvalidScopes: { Code: ErrInvalidScopes, Message: "Some of the provided scopes do not exist", @@ -1041,20 +1063,6 @@ Otherwise start your app for local development with: %s`, Remediation: fmt.Sprintf("Change in to a Slack project directory. A Slack project always includes the Slack hooks file (`%s`).", filepath.Join(".slack", "hooks.json")), }, - ErrInvalidDatastore: { - Code: ErrInvalidDatastore, - Message: "Invalid datastore specified in your project", - }, - - ErrInvalidDatastoreExpression: { - Code: ErrInvalidDatastoreExpression, - Message: "The provided expression is not valid", - Remediation: strings.Join([]string{ - "Verify the expression you provided is valid JSON surrounded by quotations", - fmt.Sprintf("Use %s for examples", style.Commandf("datastore --help", false)), - }, "\n"), - }, - ErrInvalidToken: { Code: ErrInvalidToken, Message: "The provided token is not valid", @@ -1090,17 +1098,6 @@ Otherwise start your app for local development with: %s`, Message: "The provided trigger type is not recognized", }, - ErrInvalidSandboxTemplateID: { - Code: ErrInvalidSandboxTemplateID, - Message: "The provided sandbox template value is invalid", - }, - - ErrInvalidSandboxTeamID: { - Code: ErrInvalidSandboxTeamID, - Message: "The provided sandbox team ID is invalid", - Remediation: fmt.Sprintf("List your sandboxes with the %s command to find the ID", style.Commandf("sandbox list", false)), - }, - ErrInvalidUserID: { Code: ErrInvalidUserID, Message: "A value passed as a user_id is invalid", @@ -1181,16 +1178,16 @@ Otherwise start your app for local development with: %s`, Message: "The feature is behind an experiment not toggled on", }, - ErrMissingFunctionIdentifier: { - Code: ErrMissingFunctionIdentifier, - Message: "Could not find the given workflow using the specified reference", - }, - ErrMissingFlag: { Code: ErrMissingFlag, Message: "An argument must be provided for the flag", }, + ErrMissingFunctionIdentifier: { + Code: ErrMissingFunctionIdentifier, + Message: "Could not find the given workflow using the specified reference", + }, + ErrMissingInput: { Code: ErrMissingInput, Message: "A required value was not supplied as input", @@ -1226,22 +1223,6 @@ Otherwise start your app for local development with: %s`, Message: "Missing `value` property on an input. You must either provide the value now, or mark this input as `customizable`: `true` and provide the value at the time the trigger is executed.", }, - ErrNotAuthed: { - Code: ErrNotAuthed, - Message: "You are either not logged in or your login session has expired", - Remediation: fmt.Sprintf("Authorize your CLI with %s", style.Commandf("login", false)), - }, - - ErrNotBearerToken: { - Code: ErrNotBearerToken, - Message: "Incompatible token type provided", - }, - - ErrNotFound: { - Code: ErrNotFound, - Message: "Couldn't find row", - }, - ErrNoAppSelected: { Code: ErrNoAppSelected, Message: "No app selected", @@ -1279,19 +1260,20 @@ Otherwise start your app for local development with: %s`, Message: "None of the provided named entities were valid", }, - ErrOrgNotConnected: { - Code: ErrOrgNotConnected, - Message: "One or more of the listed organizations was not connected", + ErrNotAuthed: { + Code: ErrNotAuthed, + Message: "You are either not logged in or your login session has expired", + Remediation: fmt.Sprintf("Authorize your CLI with %s", style.Commandf("login", false)), }, - ErrOrgNotFound: { - Code: ErrOrgNotFound, - Message: "One or more of the listed organizations could not be found", + ErrNotBearerToken: { + Code: ErrNotBearerToken, + Message: "Incompatible token type provided", }, - ErrOrgGrantExists: { - Code: ErrOrgGrantExists, - Message: "A different org workspace grant already exists for the installed app", + ErrNotFound: { + Code: ErrNotFound, + Message: "Couldn't find row", }, ErrOSNotSupported: { @@ -1299,6 +1281,21 @@ Otherwise start your app for local development with: %s`, Message: "This operating system is not supported", }, + ErrOrgGrantExists: { + Code: ErrOrgGrantExists, + Message: "A different org workspace grant already exists for the installed app", + }, + + ErrOrgNotConnected: { + Code: ErrOrgNotConnected, + Message: "One or more of the listed organizations was not connected", + }, + + ErrOrgNotFound: { + Code: ErrOrgNotFound, + Message: "One or more of the listed organizations could not be found", + }, + ErrOverResourceLimit: { Code: ErrOverResourceLimit, Message: "Workspace exceeded the maximum number of Run On Slack functions and/or app datastores.", @@ -1338,31 +1335,31 @@ Otherwise start your app for local development with: %s`, Message: "Failed to update project files", }, - ErrProviderNotFound: { - Code: ErrProviderNotFound, - Message: "The provided provider_key is invalid", - }, - ErrPrompt: { Code: ErrPrompt, Message: "An error occurred while executing prompts", }, + ErrProviderNotFound: { + Code: ErrProviderNotFound, + Message: "The provided provider_key is invalid", + }, + ErrPublishedAppOnly: { Code: ErrPublishedAppOnly, Message: "This action is only permitted for published app IDs", }, - ErrRequestIDOrAppIDIsRequired: { - Code: ErrRequestIDOrAppIDIsRequired, - Message: "Must include a request_id or app_id", - }, - ErrRatelimited: { Code: ErrRatelimited, Message: "Too many calls in succession during a short period of time", }, + ErrRequestIDOrAppIDIsRequired: { + Code: ErrRequestIDOrAppIDIsRequired, + Message: "Must include a request_id or app_id", + }, + ErrRestrictedPlanLevel: { Code: ErrRestrictedPlanLevel, Message: "Your Slack plan does not have access to the requested feature", @@ -1379,31 +1376,6 @@ Otherwise start your app for local development with: %s`, Message: "The SDK runtime is not supported by the CLI", }, - ErrSandboxDomainTaken: { - Code: ErrSandboxDomainTaken, - Message: "This domain has been claimed by another sandbox", - }, - - ErrSandboxDomainTooLong: { - Code: ErrSandboxDomainTooLong, - Message: "Sandbox name or domain is too long", - }, - - ErrSampleCreate: { - Code: ErrSampleCreate, - Message: "Couldn't create app from sample", - }, - - ErrServiceLimitsExceeded: { - Code: ErrServiceLimitsExceeded, - Message: "Your workspace has exhausted the 10 apps limit for free teams. To create more apps, upgrade your Slack plan at https://my.slack.com/plans", - }, - - ErrSharedChannelDenied: { - Code: ErrSharedChannelDenied, - Message: "The team admin does not allow shared channels to be named_entities", - }, - ErrSDKConfigLoad: { Code: ErrSDKConfigLoad, Message: fmt.Sprintf("There was an error while reading the Slack hooks file (`%s`) or running the `get-hooks` hook", filepath.Join(".slack", "hooks.json")), @@ -1433,6 +1405,36 @@ Otherwise start your app for local development with: %s`, }, "\n"), }, + ErrSampleCreate: { + Code: ErrSampleCreate, + Message: "Couldn't create app from sample", + }, + + ErrSandboxDomainTaken: { + Code: ErrSandboxDomainTaken, + Message: "This domain has been claimed by another sandbox", + }, + + ErrSandboxDomainTooLong: { + Code: ErrSandboxDomainTooLong, + Message: "Sandbox name or domain is too long", + }, + + ErrScopesExceedAppConfig: { + Code: ErrScopesExceedAppConfig, + Message: "Scopes requested exceed app configuration", + }, + + ErrServiceLimitsExceeded: { + Code: ErrServiceLimitsExceeded, + Message: "Your workspace has exhausted the 10 apps limit for free teams. To create more apps, upgrade your Slack plan at https://my.slack.com/plans", + }, + + ErrSharedChannelDenied: { + Code: ErrSharedChannelDenied, + Message: "The team admin does not allow shared channels to be named_entities", + }, + ErrSlackAuth: { Code: ErrSlackAuth, Message: "You are not logged into a team or have not installed an app", @@ -1462,11 +1464,6 @@ Otherwise start your app for local development with: %s`, Message: "Couldn't connect to Slack over WebSocket", }, - ErrScopesExceedAppConfig: { - Code: ErrScopesExceedAppConfig, - Message: "Scopes requested exceed app configuration", - }, - ErrStreamingActivityLogs: { Code: "streaming_activity_logs_error", Message: "Failed to stream the most recent activity logs", @@ -1631,27 +1628,22 @@ Otherwise start your app for local development with: %s`, Message: "Unable to find the corresponding type based on the schema ref", }, - ErrUntrustedSource: { - Code: ErrUntrustedSource, - Message: "Source is by an unknown or untrusted author", - Remediation: "Use --force flag or set trust_unknown_sources: true in config.json file to disable warning", - }, - ErrUnknownWorkflowID: { Code: ErrUnknownWorkflowID, Message: "The provided workflow_id was not found for this app", }, - ErrUserIDIsRequired: { - Code: ErrUserIDIsRequired, - Message: "Must include a user_id to cancel request for an app with app_id", - }, - ErrUnsupportedFileName: { Code: ErrUnsupportedFileName, Message: "File name is not supported", }, + ErrUntrustedSource: { + Code: ErrUntrustedSource, + Message: "Source is by an unknown or untrusted author", + Remediation: "Use --force flag or set trust_unknown_sources: true in config.json file to disable warning", + }, + ErrUserAlreadyOwner: { Code: ErrUserAlreadyOwner, Message: "The user is already an owner for this app", @@ -1668,6 +1660,11 @@ Otherwise start your app for local development with: %s`, Remediation: "Reach out to one of your App Managers to request permissions to install apps.", }, + ErrUserIDIsRequired: { + Code: ErrUserIDIsRequired, + Message: "Must include a user_id to cancel request for an app with app_id", + }, + ErrUserNotFound: { Code: ErrUserNotFound, Message: "User cannot be found", From f73c93e6d133cd7fb02d2851a49cc6e1461833e6 Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 2 Jun 2026 13:55:26 -0700 Subject: [PATCH 2/4] fix: restore blank lines in ErrAppDeployNotSlackHosted remediation Co-Authored-By: Claude --- internal/slackerror/errors.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/slackerror/errors.go b/internal/slackerror/errors.go index 0da15608..1959724f 100644 --- a/internal/slackerror/errors.go +++ b/internal/slackerror/errors.go @@ -355,8 +355,11 @@ var ErrorCodeMap = map[string]Error{ ErrorDetail{Message: "Deployment to Slack is currently supported for apps written with the Deno Slack SDK."}, }, Remediation: fmt.Sprintf(`Learn about building apps with the Deno Slack SDK: + https://docs.slack.dev/tools/deno-slack-sdk + If you are using a Bolt framework, add a deploy hook then run: %s + Otherwise start your app for local development with: %s`, style.Commandf("deploy", true), style.Commandf("run", true), From a56fdef5c3e9291d5bf989c38196dae1e31dcf8b Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 2 Jun 2026 14:02:18 -0700 Subject: [PATCH 3/4] fix: sort generated errors reference alphabetically by error code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ErrorCodeMap is a Go map, so iteration order was random — the generated errors.md output was non-deterministic. Sort entries by their Code field before rendering the template. Co-Authored-By: Claude --- cmd/docgen/docgen.go | 11 +++++++++-- cmd/docgen/errors.tmpl | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index cd035390..b300f29a 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -108,7 +108,7 @@ func runDocGenCommandFunc(clients *shared.ClientFactory, cmd *cobra.Command, arg return slackerror.New(slackerror.ErrDocumentationGenerationFailed).WithRootCause(err) } - // Generate errors reference + // Generate errors reference sorted alphabetically by error code file, err := clients.Fs.Create(filepath.Join(docsDirPath, "errors.md")) if err != nil { return err @@ -118,7 +118,14 @@ func runDocGenCommandFunc(clients *shared.ClientFactory, cmd *cobra.Command, arg if err != nil { return err } - err = tmpl.Execute(file, slackerror.ErrorCodeMap) + sortedErrors := make([]slackerror.Error, 0, len(slackerror.ErrorCodeMap)) + for _, e := range slackerror.ErrorCodeMap { + sortedErrors = append(sortedErrors, e) + } + slices.SortFunc(sortedErrors, func(a, b slackerror.Error) int { + return strings.Compare(a.Code, b.Code) + }) + err = tmpl.Execute(file, sortedErrors) if err != nil { return err } diff --git a/cmd/docgen/errors.tmpl b/cmd/docgen/errors.tmpl index 1d928f6c..a2213c1e 100644 --- a/cmd/docgen/errors.tmpl +++ b/cmd/docgen/errors.tmpl @@ -6,7 +6,7 @@ ones, as well as a list of the errors the Slack CLI may raise, what they mean, and some ways to remediate them. ## Slack CLI errors list -{{range $key, $err := . }} +{{range $err := . }} ### {{ $err.Code }} {#{{ $err.Code }}} {{ if $err.Message }} **Message**: {{ $err.Message }} From 1a9fe50a582d526aeb4b6b8c8a0c846a05bf1eea Mon Sep 17 00:00:00 2001 From: Eden Zimbelman Date: Tue, 2 Jun 2026 14:03:16 -0700 Subject: [PATCH 4/4] refactor: rename sortedErrors to errors Co-Authored-By: Claude --- cmd/docgen/docgen.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/docgen/docgen.go b/cmd/docgen/docgen.go index b300f29a..7cbdd591 100644 --- a/cmd/docgen/docgen.go +++ b/cmd/docgen/docgen.go @@ -118,14 +118,14 @@ func runDocGenCommandFunc(clients *shared.ClientFactory, cmd *cobra.Command, arg if err != nil { return err } - sortedErrors := make([]slackerror.Error, 0, len(slackerror.ErrorCodeMap)) + errors := make([]slackerror.Error, 0, len(slackerror.ErrorCodeMap)) for _, e := range slackerror.ErrorCodeMap { - sortedErrors = append(sortedErrors, e) + errors = append(errors, e) } - slices.SortFunc(sortedErrors, func(a, b slackerror.Error) int { + slices.SortFunc(errors, func(a, b slackerror.Error) int { return strings.Compare(a.Code, b.Code) }) - err = tmpl.Execute(file, sortedErrors) + err = tmpl.Execute(file, errors) if err != nil { return err }