DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.

DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
CloudStack currently generates many API error messages through ad-hoc string construction, leading to inconsistencies, limited customization, and no clear support for localization.
This feature introduces a structured, key-based error messaging framework where the management server emits a stable error message key along with contextual metadata. Clients and operators can use these to present consistent, customizable, and localized error messages.
...
Instead of hard-coded strings, exceptions are raised with:
API error responses include the following additional fields:
The existing errortext field is preserved for backward compatibility.
Example:
| Code Block |
|---|
{
"deployvirtualmachineresponse": {
"errorcode": 431,
"cserrorcode": 4350,
"errortext": "Unable to deploy Instance as the given service offering 'test' (ID: 13, UUID: ...) is inactive. Specify an active service offering.",
"errortextkey": "vm.deploy.serviceoffering.inactive",
"errormetadata": {
"serviceOffering": "'test' (ID: 13, UUID: ...)"
}
}
}
|
...
Each entry maps an error message key to a message template.
Error message keys follow a structured, hierarchical naming convention to ensure consistency, readability, and easy discoverability.
The general format is:
<actionable_resource>.<action>.<failing_resource_or_entity>.<cause_and_context>...
Where:
actionable_resource
The primary resource or feature being acted upon
(e.g., vm, volume, network, template)
action
The operation being performed
(e.g., deploy, start, attach, detach, update)
failing_resource_or_entity
The resource or entity that caused the failure
(e.g., serviceoffering, diskoffering, host, cluster, ip)
cause and context
The specific reason for the failure
(e.g., not.found, inactive, invalid, conflict, unsupported)
Templates support placeholder substitution using {{placeholder}} syntax.
Admin-specific variants are supported by adding a .admin suffix to the key.
Example:
| Code Block |
|---|
{
"vm.deploy.serviceoffering.inactive":
"Unable to deploy Instance as the given service offering {{serviceOffering}} is inactive. Specify an active service offering.",
"vm.deploy.serviceoffering.inactive.admin":
"Unable to deploy Instance as service offering {{serviceOffering}} is inactive. Please activate it or choose a different offering."
}
|
A new component, ErrorMessageResolver, is responsible for resolving error message keys into user-facing messages.
Responsibilities:
error-messages.json.The caller’s role is determined using CallContext.
If the caller is a root admin and an admin-specific template exists, it is used; otherwise, the default template is applied.
...
The initial implementation applies this framework to selected validation paths in the VM deployment flow.
Additional flows and modules can be incrementally migrated in future releases.
error-messages.json is installed as a configuration file and not overwritten during upgrades.Localization of error messages is handled at the client side.
The CloudStack management server returns a stable error message key (errortextkey) along with contextual metadata (errormetadata). Clients are expected to resolve this key into a localized, user-facing message.
When using the official CloudStack UI:
Localized messages for error message keys can be added to the existing UI locale files.
Each locale file maps error message keys to translated message templates.
Placeholders in the localized templates are substituted using values from errormetadata.
This approach:
Keeps localization concerns out of the management server.
Allows UI translations to evolve independently.
Enables consistent localization across API consumers.
Other API clients (CLI tools, SDKs, external integrations) may:
Maintain their own localization mappings for error message keys, or
Fall back to using the server-provided errortext if localization is not implemented.
Unit tests for:
Integration tests validating API responses include error message keys and metadata.