fix: error on empty destination when creating a default transfer tool

This commit is contained in:
Sabiha Khan 2026-07-13 16:44:14 +05:30
parent 6d1051757c
commit 50e3c8c281
3 changed files with 7 additions and 9 deletions

View file

@ -266,10 +266,6 @@ class TransferCallConfig(BaseModel):
@model_validator(mode="after")
def validate_destination_source_config(self):
if self.destination_source == "static" and not self.destination.strip():
raise ValueError(
"config.destination is required when destination_source is static"
)
if self.destination_source == "dynamic" and self.resolver is None:
raise ValueError(
"config.resolver is required when destination_source is dynamic"

View file

@ -17,9 +17,11 @@ def test_transfer_call_destination_accepts_provider_specific_literal():
assert config.destination == "provider-specific-destination"
def test_transfer_call_static_requires_destination():
with pytest.raises(ValueError, match="destination is required"):
TransferCallConfig(destination_source="static", destination="")
def test_transfer_call_static_allows_empty_draft_destination():
config = TransferCallConfig(destination_source="static", destination="")
assert config.destination_source == "static"
assert config.destination == ""
def test_transfer_call_dynamic_requires_resolver():

View file

@ -39,6 +39,7 @@ import {
SelectValue,
} from "@/components/ui/select";
import { Skeleton } from "@/components/ui/skeleton";
import { detailFromError } from "@/lib/apiError";
import { useAuth } from "@/lib/auth";
import {
@ -154,8 +155,7 @@ export default function ToolsPage() {
});
if (response.error) {
const errorDetail = (response.error as { detail?: string })?.detail;
setCreateError(errorDetail || "Failed to create tool");
setCreateError(detailFromError(response.error, "Failed to create tool"));
return;
}