Patch Changes
-
#545
5d7c8e7
Thanks @omeraplak! - fix: resolve EADDRINUSE error on server startup by fixing race condition in port availability check - #544Fixed a critical issue where users would encounter "EADDRINUSE: address already in use" errors when starting VoltAgent servers. The problem was caused by a race condition in the port availability check where the test server wasn't fully closed before the actual server tried to bind to the same port.
What was happening
When checking if a port was available, the port manager would:
- Create a test server and bind to the port
- On successful binding, immediately close the server
- Return
true
indicating the port was available - But the test server wasn't fully closed yet when
serve()
tried to bind to the same port
The fix
Modified the port availability check in
port-manager.ts
to:- Wait for the server's close callback before returning
- Add a small delay (50ms) to ensure the OS has fully released the port
- This prevents the race condition between test server closure and actual server startup
Changes
- port-manager.ts: Fixed race condition by properly waiting for test server to close
- hono-server-provider.ts: Added proper error handling for server startup failures
This ensures reliable server startup without port conflicts.
-
#546
f12f344
Thanks @omeraplak! - chore: align Zod to ^3.25.76 and fix type mismatch with AI SDKWe aligned Zod versions across packages to
^3.25.76
to match AI SDK peer ranges and avoid multiple Zod instances at runtime.Why this matters
- Fixes TypeScript narrowing issues in workflows when consuming
@voltagent/core
from npm with a different Zod instance (e.g.,ai
packages pulling newer Zod). - Prevents errors like "Spread types may only be created from object types" where
data
failed to narrow becausez.ZodTypeAny
checks saw different Zod identities.
What changed
@voltagent/server-core
,@voltagent/server-hono
: dependencies.zod →^3.25.76
.@voltagent/docs-mcp
,@voltagent/core
: devDependencies.zod →^3.25.76
.- Examples and templates updated to use
^3.25.76
for consistency (non-publishable).
Notes for consumers
- Ensure a single Zod version is installed (consider a workspace override to pin Zod to
3.25.76
). - This improves compatibility with
ai@5.x
packages that requirezod@^3.25.76 || ^4
.
- Fixes TypeScript narrowing issues in workflows when consuming
-
Updated dependencies [
5d7c8e7
,f12f344
]:- @voltagent/server-core@1.0.1
- @voltagent/core@1.0.1