On this page
error
Exit Codes
IPM CLI exit codes and error handling reference
Error codes are introduced in IPM version 0.13.0
Introduction
The IPM CLI returns specific exit codes to indicate the success or failure of operations. These codes help with automation, scripting, and debugging by providing detailed information about what went wrong during command execution.
On Linux and macOS, exit codes are limited to 0-255. Negative exit codes are converted using modulo 256 (e.g., -100 becomes 156).
Exit Code Categories
Exit codes are organized into logical groups based on the type of operation or error:
- 0: Success
- 100-199: Informational codes
- Negative codes: Error conditions (displayed as positive values on Linux/macOS)
Success and Information Codes
Success
- 0 -
Ok
: Operation completed successfully
Informational
- 100 -
NoVersionFoundForPackage
: No “latest” version available for package - 101 -
SpecifiedVersionNotFoundForPackage
: Specified version not found for package - 200 -
SearchNoResults
: Search operation returned no results
Error Codes
Validation - Formatting (-100 to -109)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-100 | 156 | PackageNameNotFormattedCorrectly |
Package name doesn’t follow naming rules | Use format owner/package-name with only lowercase letters, numbers, hyphens, and underscores |
-101 | 155 | VersionNotFormattedCorrectly |
Invalid semantic version format | Use semantic versioning format: 1.2.3 (major.minor.patch) |
-102 | 154 | PatternNotFormattedCorrectly |
Search pattern has invalid syntax | Check pattern syntax and escape special characters if needed |
Validation - Generic/Workspace (-110 to -149)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-110 | 146 | SummaryReportInvalid |
Invalid summary file location | Verify the path exists and you have write permissions |
-120 | 136 | PackageNotFound |
Package not found | Check package name spelling and verify it exists on IPMHub |
-121 | 135 | PackageVersionNotFound |
Package version not found | Verify version exists or use ipm info to see available versions |
-130 | 126 | WorkspaceNotInitialized |
Not an IPMHub workspace | Run ipm init to initialize the workspace |
-131 | 125 | WorkspaceConfigurationValidationFailed |
Workspace config validation failed | Check ipmhub.json for syntax errors or missing required fields |
-132 | 124 | WorkspaceStatusAquireFailed |
Failed to acquire workspace status | Check network connectivity and authentication |
-140 | 116 | WorkspaceInitializationFailed |
Workspace initialization failed | Verify write permissions and disk space |
Actions - Build/Pack (-200 to -209)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-200 | 56 | PackFoldersValidationFailed |
Source/destination folder validation failed | Verify folders exist and have correct permissions |
-201 | 55 | PackFolderFailed |
Build operation failed | Check source folder contents and destination permissions |
-202 | 54 | PackManifestValidationFailed |
Generated manifest is invalid | Review package contents and manifest generation settings |
-203 | 53 | PackCreationOfActionSummaryReportFailed |
Failed to create build summary report | Check summary file path and write permissions |
Actions - Publish (-210 to -219)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-210 | 46 | PublishFailedUnknown |
Unknown publishing error | Check logs for details and retry |
-211 | 45 | PublishFailedAlreadyExist |
Version already exists | Use a different version number |
-212 | 44 | PublishFailedInvalidHash |
Hash/signature mismatch | Rebuild package or check for file corruption |
-213 | 43 | PublishFailedUnauthorized |
Not authenticated | Run ipm login or provide valid client secrets |
-214 | 42 | PublishFailedForbidden |
Insufficient permissions | Contact organization admin to grant publish permissions |
-215 | 41 | PublishFailedCanceled |
Operation canceled | Retry the operation |
-216 | 40 | PublishFailedWebException |
Network or web error | Check internet connectivity and retry |
-218 | 38 | PublishCreationOfActionSummaryReportFailed |
Failed to create publish summary report | Check summary file path and write permissions |
Actions - Extract/Export (-230 to -239)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-230 | 26 | ExtractionFailedUnknown |
Unknown extraction error | Check logs for details and retry |
-231 | 25 | ExtractionFoldersValidationFailed |
Invalid input folders | Verify folder paths and permissions |
-232 | 24 | ExtractionFailedCanceled |
Operation canceled | Retry the operation |
-233 | 23 | ExtractionFailedInvalidHash |
Hash/signature mismatch | Re-download package or check for corruption |
-234 | 22 | ExtractionManifestValidationFailed |
Invalid manifest | Package may be corrupted, try re-downloading |
Actions - Add (-240 to -249)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-240 | 16 | AddingFailedInvalidWorkingFolder |
Invalid working folder | Check folder path in workspace configuration |
-241 | 15 | AddingFailedAlreadyConfigured |
Package already configured | Remove existing package first or use --force if available |
-242 | 14 | AddingFailedConflict |
Conflict detected | Resolve workspace conflicts and retry |
-243 | 13 | AddingFailedWorkspaceSave |
Failed to save workspace | Check write permissions for ipmhub.json |
-244 | 12 | AddingFailedCanceled |
Operation canceled | Retry the operation |
Sync (-250 to -259)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-250 | 6 | SynchronizationFailed |
Synchronization error | Check network connectivity and workspace status |
Search (-260 to -269)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-260 | 252 | SearchFailedUnknown |
Unknown search error | Check network connectivity and retry |
-261 | 251 | SearchFailedCanceled |
Search operation canceled | Retry the search |
Package Download (-270 to -279)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-270 | 242 | PackageDownloadFailedUnknown |
Unknown download error | Check network connectivity and retry |
-271 | 241 | PackageDownloadFailedForbidden |
Download forbidden | Authenticate or request access to the package |
CLI Configuration (-300 to -309)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-300 | 212 | CliConfigurationFileNotFound |
Configuration file missing | Run initial setup or recreate config file |
-301 | 211 | CliConfigurationFileInvalid |
Configuration file invalid | Check config file syntax or delete and recreate |
Authentication (-400 to -449)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-400 | 112 | AuthenticationContextAquireFailed |
Failed to acquire authentication context | Run ipm login or check network connectivity |
-401 | 111 | AuthenticationContextInvalid |
Invalid authentication context | Re-authenticate with ipm login |
-402 | 110 | AuthenticationContextExpired |
Authentication context expired | Re-authenticate with ipm login |
-405 | 107 | AuthenticationRequired |
Authentication required | Run ipm login or provide client secrets |
-410 | 102 | AuthenticationContextMissing |
Authentication context missing | Run ipm login to authenticate |
-411 | 101 | AuthenticationContextAquireCanceled |
Authentication canceled | Complete authentication process |
-412 | 100 | AuthenticationContextAquireCanceledUnknown |
Authentication canceled (unknown reason) | Retry authentication |
-413 | 99 | AuthenticationContextSaveFailed |
Failed to save authentication context | Check file permissions in user profile directory |
Client Secrets/Non-Interactive (-450 to -459)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-450 | 62 | NonInteractiveRequestedNoClientSecretFound |
No client secret found | Provide client secret via parameter or environment variable |
-451 | 61 | NonInteractiveAuthenticationContextAquireFailed |
Failed to acquire non-interactive auth context | Verify client secret validity and permissions |
Generic (-1 to -9)
Code | Linux/macOS | Name | Description | Common Solutions |
---|---|---|---|---|
-1 | 255 | GenericError |
Unspecified error | Check logs for more details and contact support if needed |
Using Exit Codes in Scripts
Using Exit Codes in Scripts
Bash/Shell Scripts (Linux/macOS)
#!/bin/bash
### Run IPM command and capture exit code
ipm add --package mycompany/mypackage
EXIT_CODE=$?
case $EXIT_CODE in
0)
echo "Package added successfully"
;;
136) # PackageNotFound
echo "Error: Package not found. Check the package name."
exit 1
;;
43) # PublishFailedUnauthorized
echo "Error: Not authenticated. Running login..."
ipm login
;;
42) # PublishFailedForbidden
echo "Error: Insufficient permissions. Contact your administrator."
exit 1
;;
*)
echo "Unexpected error occurred (exit code: $EXIT_CODE)"
exit 1
;;
esac
PowerShell Scripts (Windows)
### Run IPM command and handle exit codes
& ipm add --package mycompany/mypackage
$exitCode = $LASTEXITCODE
switch ($exitCode) {
0 {
Write-Host "Package added successfully" -ForegroundColor Green
}
-120 { # PackageNotFound
Write-Host "Error: Package not found. Check the package name." -ForegroundColor Red
exit 1
}
-213 { # PublishFailedUnauthorized
Write-Host "Error: Not authenticated. Running login..." -ForegroundColor Yellow
& ipm login
}
-214 { # PublishFailedForbidden
Write-Host "Error: Insufficient permissions. Contact your administrator." -ForegroundColor Red
exit 1
}
default {
Write-Host "Unexpected error occurred (exit code: $exitCode)" -ForegroundColor Red
exit 1
}
}
CI/CD Pipeline Integration
# Azure DevOps Pipeline example
- task: Bash@3
displayName: 'Add Package'
inputs:
targetType: 'inline'
script: |
ipm add --package mycompany/mypackage --non-interactive
EXIT_CODE=$?
# On Linux/macOS: -213 becomes 43, -405 becomes 107, -120 becomes 136
if [ $EXIT_CODE -eq 43 ] || [ $EXIT_CODE -eq 107 ]; then
echo "##vso[task.logissue type=error]Authentication required"
exit 1
elif [ $EXIT_CODE -eq 136 ]; then
echo "##vso[task.logissue type=error]Package not found"
exit 1
elif [ $EXIT_CODE -ne 0 ]; then
echo "##vso[task.logissue type=error]IPM command failed with exit code $EXIT_CODE"
exit 1
fi
echo "Package added successfully"
Troubleshooting Common Exit Codes
Authentication Issues (-400 series, Linux/macOS: 99-112)
Most authentication problems can be resolved by:
- Running
ipm login
for interactive authentication - Providing valid client secrets for non-interactive scenarios
- Checking network connectivity to IPMHub
Package Not Found (-120/-121, Linux/macOS: 135-136)
When packages aren’t found:
- Verify the package name spelling
- Check if the package exists using
ipm search
- Ensure you have access permissions for private/hybrid packages
- For specific versions, use
ipm info
to see available versions
Permission Issues (-214/-271, Linux/macOS: 42/241)
Permission errors typically require:
- Organization membership for private packages
- Contributor role for publishing operations
- Valid subscription for premium features
Workspace Issues (-130/-131, Linux/macOS: 125-126)
Workspace-related errors usually need:
- Running
ipm init
to initialize workspace - Fixing syntax errors in
ipmhub.json
- Ensuring proper file permissions
Best Practices
Error Handling in Automation
- Always check exit codes in automated scripts
- Account for platform differences (negative codes on Windows, positive on Linux/macOS)
- Provide meaningful error messages based on specific exit codes
- Implement retry logic for transient errors (network issues)
- Log exit codes for debugging and monitoring
Debugging with Exit Codes
- Use verbose logging (
--loglevel Debug
) when debugging - Check specific error categories to narrow down issues
- Verify prerequisites (authentication, permissions, network) first
- Consult documentation for error-specific solutions
- Remember platform-specific exit code conversions when troubleshooting
Exit codes are available starting with IPM CLI version 0.13.0. Earlier versions may not return specific error codes.
Use exit codes in your automation scripts to handle specific error conditions gracefully and provide better user experience.