alibaba/spring-ai-alibaba · error · StudioException
403
403
Error message
不支持通过接口创建模型配置,请使用 model-config.yml
What it means
ModelConfigServiceImpl.create is intentionally disabled: model configurations must be managed via the model-config.yml file. The method always throws StudioException with code NO_RIGHT (403) to preserve API compatibility while preventing misuse.
Solutions
- Add the model configuration to model-config.yml and restart/reload instead of calling the API
- Upgrade or update the calling client to stop using the create endpoint
- If API writes are genuinely needed, re-enable a controlled write path in a fork — not recommended
Example fix
// before
POST /api/model-configs {"name":"gpt4", ...} // 403
// after
# model-config.yml
models:
- name: gpt4
provider: openai
apiKey: ${OPENAI_API_KEY} Defensive patterns
Strategy: try-catch
Validate before calling
// No pre-call validation helps: the operation is always rejected; switch to model-config.yml
Type guard
null
Try / catch
try { service.create(req); } catch (StudioException e) { if (e.getCode() == StudioException.NO_RIGHT) { /* use model-config.yml instead */ } } Prevention
- Manage all model configs via model-config.yml
- Upgrade clients that still call the retired create endpoint
- Document the config-file workflow for integrators
When it happens
Trigger: Any call to the create endpoint/service method, whether the controller was re-exposed, an old client version still calls it, or code invokes the service directly.
Common situations: Older frontend or SDK still posting to the removed create endpoint; automation scripts created before the write-interface shutdown; custom integrations that bypass the yml workflow.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/1a2df1e953c8721a.
Report an issue: GitHub.
Appendix: source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/service/impl/ModelConfigServiceImpl.java:37
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Service
@RequiredArgsConstructor
public class ModelConfigServiceImpl implements ModelConfigService {
private final ModelConfigRepository modelConfigRepository;
private final ObjectMapper objectMapper;
private final ChatClientFactoryDelegate chatClientFactoryDelegate;
// 写接口已下线:保留签名以保证接口兼容性(控制器已不再暴露),避免误用
@Override
public ModelConfigResponse create(ModelConfigCreateRequest request) throws StudioException {
throw new StudioException(StudioException.NO_RIGHT, "不支持通过接口创建模型配置,请使用 model-config.yml");
}
@Override
public ModelConfigResponse update(ModelConfigUpdateRequest request) throws StudioException {
throw new StudioException(StudioException.NO_RIGHT, "不支持通过接口更新模型配置,请使用 model-config.yml");
}
@Override
public void delete(Long id) throws StudioException {
throw new StudioException(StudioException.NO_RIGHT, "不支持通过接口删除模型配置,请使用 model-config.yml");
}
@Override
public PageResult<ModelConfigResponse> list(ModelConfigQueryRequest request) {
log.info("查询模型配置列表: {}", request);
int offset = (request.getPage() - 1) * request.getSize();
View on GitHub (pinned to f82da0b50f)