dotnet/orleans · warning · Error
/api/load failed with ${response.status}
Error message
/api/load failed with ${response.status} What it means
A browser-side Error thrown by saveSettings() in the DurableJobsJournaling web frontend when the PUT /api/load request to save load-test settings returns a non-2xx status. Unlike the generic post() helper, this path issues a PUT with a JSON body and checks response.ok before applying the returned settings and refreshing. The message is hardcoded to '/api/load'.
Source
Thrown at playground/DurableJobsJournaling/DurableJobsJournaling.Web/wwwroot/index.html:117
options.body = JSON.stringify(body);
}
const response = await fetch(url, options);
if (!response.ok) {
throw new Error(`${url} failed with ${response.status}`);
}
await refresh();
}
async function saveSettings() {
const response = await fetch('/api/load', {
method: 'PUT',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(settings())
});
if (!response.ok) {
throw new Error(`/api/load failed with ${response.status}`);
}
applySettings(await response.json());
await refresh();
}
async function startLoad() {
await post('/api/load/start', settings());
}
function settings() {
return {
targetConcurrency: Number(concurrency.value),
targetStartsPerSecond: Number(throughput.value),
stageDelayMilliseconds: 0,
stageJitterMilliseconds: 0,
failureRate: 0,
dueTimeMode: 'Immediate',View on GitHub (pinned to fca799fa70)
Solutions
- Read the status code in the message: 400 => invalid settings payload, 404 => route missing, 5xx => server fault.
- Validate the settings object client-side (ranges, required fields) before sending the PUT.
- Check server logs for model-validation or controller exceptions on /api/load.
Example fix
// before
if (!response.ok) {
throw new Error(`/api/load failed with ${response.status}`);
}
// after (capture server validation detail)
if (!response.ok) {
const detail = await response.text().catch(() => "<no body>");
throw new Error(`/api/load failed with ${response.status}: ${detail}`);
} Defensive patterns
Strategy: validation
Validate before calling
function validateSettings(s) {
if (typeof s.rate !== 'number' || s.rate < 0) throw new Error('rate must be >= 0');
// ...other fields
return s;
}
// call before fetch('/api/load', ...) Type guard
function isSettings(o) {
return o && typeof o === 'object'
&& typeof o.rate === 'number' && o.rate >= 0;
} Try / catch
async function saveSettings() {
try {
const response = await fetch('/api/load', { method:'PUT', headers:{'content-type':'application/json'}, body: JSON.stringify(settings()) });
if (!response.ok) throw new Error(`/api/load failed: ${response.status}`);
applySettings(await response.json());
await refresh();
} catch (err) {
showError('Settings not saved: ' + err.message);
}
} Prevention
- Validate settings client-side (ranges, required fields) before the PUT.
- Show save errors in the UI rather than only logging.
- Confirm the backend route and model binding accept your payload shape.
When it happens
Trigger: The user changes settings in the UI and the action triggers saveSettings(); the server rejects the PUT — e.g., the settings JSON fails server validation, the load controller is missing, or the backend is down.
Common situations: Invalid settings values (out-of-range rates, negative counts), a controller/model-validation failure on the server, or backend unavailability. The error status in the message distinguishes them.
Related errors
- HTTP error! status: ${response.status}
- Network response was not ok
- ${url} failed with ${response.status}
- Withdrawing {amount} credits from account "{this.GetPrimaryK
- WEBSITE_PRIVATE_PORTS must contain at least one TCP port.
AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13).
Data as JSON: /api/errors/4bde0436d616bcc1.
Report an issue: GitHub.