This guide covers common import issues when building Hyperware apps and how to resolve them.
DO NOT add hyperware_process_lib as a direct dependency in your Cargo.toml. The hyperprocess macro provides it automatically.
error[E0659]: `hyperware_process_lib` is ambiguous
--> src/lib.rs:2:5
|
2 | use hyperware_process_lib::{our, homepage::add_to_homepage};
| ^^^^^^^^^^^^^^^^^^^^^ ambiguous name
Cause: You have hyperware_process_lib in your Cargo.toml dependencies.
Solution: Remove it from Cargo.toml. The hyperprocess macro already provides access to it.
Follow the samchat example:
use hyperprocess_macro::hyperprocess;
use hyperware_process_lib::{our, homepage::add_to_homepage};
use serde::{Deserialize, Serialize};[dependencies]
anyhow = "1.0"
chrono = { version = "0.4", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
uuid = { version = "1.4.1", features = ["v4", "serde"] }
wit-bindgen = "0.36.0"
# ... other dependencies
# DO NOT ADD hyperware_process_lib here!
[dependencies.hyperprocess_macro]
git = "https://github.com/hyperware-ai/hyperprocess-macro"
rev = "47400ab"
[dependencies.hyperware_app_common]
git = "https://github.com/hyperware-ai/hyperprocess-macro"
rev = "47400ab"The hyperprocess macro expands to include imports from hyperware_process_lib. When you also add it as a direct dependency, Rust sees two different ways to access the same crate:
- Through your direct dependency
- Through the macro expansion
This creates ambiguity that prevents compilation.
- Copy working examples: Look at samchat or other working apps for the correct pattern
- Keep dependencies minimal: Only add what you actually need
- Use consistent versions: Ensure git dependencies use the same revision across your project
- Trust the macro: The hyperprocess macro handles most imports for you
If you see import errors:
- Check if you have
hyperware_process_libin Cargo.toml - remove it - Ensure you're using the import pattern from working examples
- Run
cargo cleanand rebuild if you've made dependency changes - Check that all git dependencies use consistent revisions
The hyperprocess macro automatically makes available:
our()- access to process identityhomepage::add_to_homepage()- homepage registration- Request/Response types through generated code
- All necessary trait implementations
You don't need to manually import the process lib to access these.