alibaba/spring-ai-alibaba · error · BizException
INVALID_PARAMS
INVALID_PARAMS
Error message
path
What it means
Thrown when config.path is non-blank but does not start with a forward slash. validateTool normalizes tool endpoints as absolute context-relative paths, so a path like `weather` or `https://host/weather` is rejected as malformed. The error message carries the hint 'start with /'.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/PluginController.java:419
throw new BizException(ErrorCode.MISSING_PARAMS.toError("tool"));
}
String name = tool.getName();
String description = tool.getDescription();
if (StringUtils.isBlank(name)) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("name"));
}
if (StringUtils.isBlank(description)) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("description"));
}
String path = tool.getConfig().getPath();
if (StringUtils.isBlank(path)) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("path"));
}
if (!path.startsWith("/")) {
throw new BizException(ErrorCode.INVALID_PARAMS.toError("path", "start with /"));
}
String requestMethod = tool.getConfig().getRequestMethod();
requestMethod = StringUtils.lowerCase(requestMethod);
if (StringUtils.isBlank(requestMethod)) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("requestMethod"));
}
if (!SUPPORT_METHOD.contains(requestMethod)) {
throw new BizException(ErrorCode.INVALID_PARAMS.toError("requestMethod", "method not supported"));
}
if ("post".equalsIgnoreCase(requestMethod)) {
String contentType = tool.getConfig().getContentType();
if (contentType == null) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("contentType"));
}
View on GitHub (pinned to f82da0b50f)
Solutions
- Change the path to start with '/', e.g. 'weather' -> '/weather'
- If you have a full URL, strip scheme+host and keep only the path portion
- Add a leading '/' programmatically before calling the API
- Check for whitespace/BOM characters at the start of the path string
Example fix
// before
"config": {"path":"weather","requestMethod":"GET"}
// after
"config": {"path":"/weather","requestMethod":"GET"} Defensive patterns
Strategy: validation
Validate before calling
if (path != null && !path.startsWith("/")) { path = "/" + path; } Type guard
boolean isContextRelativePath(String p) { return p != null && p.startsWith("/"); } Try / catch
try { pluginController.createTool(tool); } catch (BizException e) { if ("path".equals(e.getMessage())) { /* normalize path to start with / and retry */ } } Prevention
- Normalize paths with a leading '/' in client code before submission
- Never paste full URLs into the path field; strip scheme and host
- Unit-test path normalization helpers
- Strip whitespace/BOM from user-entered paths
When it happens
Trigger: config.path = "weather" (missing leading slash) or a full URL "http://api.example.com/weather" passed where only the path portion is expected.
Common situations: Users pasting a complete URL into a path field meant for the route only; paths built by concatenation losing the leading slash; relative-path conventions from other frameworks carried over.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/6d121cfef7b2dafc.
Report an issue: GitHub.