Troubleshooting Guide
Common issues and solutions when working with Tairitsu browser-glue and Component Model.
Build Errors
wasm32-wasip2 target not found
Error:
error: can't find crate for `std`
|
= note: the `wasm32-wasip2` target may not be installed
Solution:
wit-bindgen version mismatch
Error:
error: failed to select a version for `wit-bindgen`
Solution: Ensure wit-bindgen version matches in Cargo.toml:
[dependencies]
wit-bindgen = { version = "0.33", features = ["realloc"] }
dev-wasm profile not defined
Error:
error: profile `dev-wasm` is not defined
Solution: Add the profile to your workspace Cargo.toml:
[profile.dev-wasm]
inherits = "release"
lto = true
opt-level = 'z'
codegen-units = 1
panic = "abort"
Projects created with tairitsu init already include this profile.
browser-glue runtime bundle not found
Error:
browser-glue runtime bundle (dist/runtime.js) not found
Solution:
- 1Run npm run build in packages/browser-glue/
- 2Or set the environment variable: TAIRITSU_RUNTIME_BUNDLE=/path/to/browser-glue/dist/runtime.js
- 3Or install via npm: npm install tairitsu-browser-glue
TypeScript compilation errors
Error:
error TS2307: Cannot find module './domGlue' or its corresponding type declarations.
Solution: Regenerate glue and rebuild:
Runtime Errors
Missing host imports
Error:
Error: Component import "tairitsu-browser:full/document" was not satisfied
Solution:
- 1Ensure import map is configured:
- 1Verify browser-glue files exist in output directory.
Component initialization failure
Error:
Error: Component instantiation failed: undefined import
Solution: Check that all required WIT imports have corresponding implementations in browser-glue.
jco transpile errors
Error:
Error: Failed to transpile component
Solution:
- 1Ensure jco is installed:
- 1Verify WASM component is valid:
Debug Techniques
Enable debug logs
In browser console:
localStorage.;
Inspect WIT bindings
View generated bindings:
|
Browser DevTools
- 1Open DevTools (F12)
- 2Check Console for errors
- 3Network tab for failed module loads
- 4Sources tab for debugging
Component validation
# Validate component structure
# Print component contents
Common Issues
Handle not found
Symptom: null returned from DOM operations
Cause: Handle was garbage collected or not registered
Solution: Ensure elements remain referenced in JavaScript
Event not firing
Symptom: Event handlers not called
Cause: Listener ID mismatch or event type incorrect
Solution: Check addEventListener returns valid listener ID
Memory leaks
Symptom: Increasing memory usage over time
Cause: Handles not released after use
Solution: Call dropHandle() when done with objects
Performance Issues
Slow component load
Solutions:
- 1Use release build: cargo build --release
- 2Enable LTO in Cargo.toml:
[profile.release]
lto = true
opt-level = 'z'
High event latency
Solutions:
- 1Avoid synchronous operations in handlers
- 2Use requestAnimationFrame for visual updates
- 3Debounce rapid events
Getting Help
- 1Check existing issues: https://github.com/anomalyco/opencode/issues
- 2Review documentation in docs/ directory
- 3Examine example code in examples/website/