Install & Compatibility
Where this runs
tested against v1.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.012s · 40.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.2s · import 0.010s · 42MB
39MB installed
● package 39MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
get_secret
✓ from robocorp.vault import get_secret
✗ from robocorp_vault import get_secret
The library's internal package name is `robocorp.vault`, not `robocorp_vault`.
SecretNotFound
✓ from robocorp.vault import SecretNotFound
Import this exception to handle cases where a requested secret does not exist.
get_secret_names
✓ from robocorp.vault import get_secret_names
Useful for listing available secret names, especially for debugging or dynamic access.
This quickstart demonstrates how to fetch a secret from the Robocorp Control Room Vault. It highlights accessing common attributes like `username` and `value`. Note that `robocorp-vault` is designed to run within a Robocorp environment, which automatically provides the necessary authentication context. For local development, specific environment variables must be configured to connect to your vault.
import os
from robocorp.vault import get_secret, SecretNotFound
# This example demonstrates how to retrieve a secret using robocorp-vault.
# It requires a Robocorp environment (e.g., running within a Robocorp Task
# or locally with appropriate environment variables like RC_API_SECRET_HOST
# and RC_API_SECRET_TOKEN set to connect to your Control Room Vault).
def access_my_example_secret():
secret_name = "MyTestSecret" # Replace with an actual secret name from your Control Room
print(f"Attempting to retrieve secret: '{secret_name}'")
try:
# The get_secret function internally handles authentication using the
# Robocorp environment context or configured API access details.
secret = get_secret(secret_name)
print(f"Successfully retrieved secret: {secret_name}")
print(f" Username: {secret.username}")
# For security, avoid printing raw passwords or sensitive values directly to logs.
# print(f" Password: {secret.password}")
if secret.value:
print(f" Generic Value (first 5 chars): {secret.value[:5]}...")
else:
print(" This secret does not have a generic 'value'.")
except SecretNotFound:
print(f"Error: Secret '{secret_name}' not found. "
"Please ensure it exists in your Robocorp Control Room Vault "
"and the bot/robot has access permissions.")
except Exception as e:
print(f"An unexpected error occurred while accessing the vault: {e}")
if __name__ == "__main__":
# Simulate environment check for local execution.
# In a real Robocorp run, these environment variables are automatically set.
if not os.environ.get("RC_API_SECRET_HOST") and not os.environ.get("ROBOCORP_WORKITEM_STATE"):
print("\n--- Local Execution Warning --- ")
print("Running outside a Robocorp environment. Secret retrieval may fail.")
print("To run locally, you need to configure RC_API_SECRET_HOST, RC_API_SECRET_TOKEN (or ROBOCORP_WORKITEM_STATE)")
print("refer to Robocorp documentation for local testing secrets.")
print("-------------------------------\n")
access_my_example_secret()
Errors
Common errors & fixes
robocorp.vault.errors.VaultNotConfiguredError: Robocorp Vault environment variables not set.
The program is attempting to access the Robocorp Vault API without the necessary `RP_VAULT_SECRET_ID` and `RP_VAULT_SECRET_VALUE` environment variables, which are essential for local development or when running outside the Robocorp Control Room environment.
fixFor local development, use `rp open` or `rp run` to initialize the environment, or manually set the `RP_VAULT_SECRET_ID` and `RP_VAULT_SECRET_VALUE` environment variables. When running in Robocorp Control Room, these variables are automatically provided.
AttributeError: 'NoneType' object has no attribute 'value'
The `vault.get_secret()` method returned `None` because a secret with the specified name does not exist in the configured vault, and the code subsequently tried to access an attribute (like `value`, `username`, or `password`) on this `None` object.
fixAlways check if the secret object returned by `vault.get_secret()` is not `None` before attempting to access its attributes. Example: `secret = vault.get_secret('my_secret'); if secret: print(secret.value)`. ModuleNotFoundError: No module named 'robocorp.vault'
The `robocorp-vault` library has not been installed in the current Python environment or the active environment is not correctly configured to include it.
fixInstall the library using pip: `pip install robocorp-vault`
Upgrade
Version history
1.4.1latest on PyPI · released Aug 23, 2026
Audit
Dependencies
No dependency data recorded yet.