Semantic-Org/Semantic-UI · error

There was an error with your request

Error message

There was an error with your request

What it means

This error is surfaced by Semantic UI's API module via the dynamic lookup settings.error[status] (api.js:705-706) when the jQuery AJAX request fails with a textStatus of 'error'. The errorFromRequest function checks if the response object has an 'error' property; if not, it falls back to settings.error['error'] which resolves to this message. It is the catch-all server error message.

Source

Thrown at src/definitions/behaviors/api.js:1128

  // request finished without aborting
  onComplete  : function(response, $module) {},

  // failed JSON success test
  onFailure   : function(response, $module) {},

  // server error
  onError     : function(errorMessage, $module) {},

  // request aborted
  onAbort     : function(errorMessage, $module) {},

  successTest : false,

  // errors
  error : {
    beforeSend        : 'The before send function has aborted the request',
    error             : 'There was an error with your request',
    exitConditions    : 'API Request Aborted. Exit conditions met',
    JSONParse         : 'JSON could not be parsed during error handling',
    legacyParameters  : 'You are using legacy API success callback names',
    method            : 'The method you called is not defined',
    missingAction     : 'API action used but no url was defined',
    missingSerialize  : 'jquery-serialize-object is required to add form data to an existing data object',
    missingURL        : 'No URL specified for api event',
    noReturnedValue   : 'The beforeSend callback must return a settings object, beforeSend ignored.',
    noStorage         : 'Caching responses locally requires session storage',
    parseError        : 'There was an error parsing your request',
    requiredParameter : 'Missing a required URL parameter: ',
    statusMessage     : 'Server gave an error: ',
    timeout           : 'Your request timed out'
  },

  regExp  : {
    required : /\{\$*[A-z0-9]+\}/g,
    optional : /\{\/\$*[A-z0-9]+\}/g,

View on GitHub (pinned to 597843ab84)

Solutions

  1. Check the browser Network tab for the actual HTTP status code and response body.
  2. Ensure the server endpoint returns JSON with an 'error' field on failure, so the module can extract a specific message instead of this generic one.
  3. Configure settings.successTest to differentiate between successful and failed responses within a 200 status.
  4. Handle the error in settings.onError(errorMessage, $module, xhr) callback for user-facing feedback.

Example fix

// before
$('.api-element').api({
  url: '/api/data',
  // no error handling configured
});

// after
$('.api-element').api({
  url: '/api/data',
  onError: function(errorMessage, $module, xhr) {
    console.error('Server error:', xhr.status, errorMessage);
    $module.closest('.ui.form').form('add errors', [errorMessage]);
  }
});
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate the endpoint is reachable before the API call
$.get('/api/health').done(function() {
  $('.el').api('query');
}).fail(function() {
  console.error('Endpoint is not reachable.');
});

Type guard

// Check if an XHR response indicates a server error
function isServerError(xhr) {
  return xhr && xhr.status >= 500;
}

Try / catch

// Handle server errors in the API module's onError callback
$('.el').api({
  onError: function(errorMessage, $module, xhr) {
    if (xhr.status >= 500) {
      console.error('Server error:', xhr.status, errorMessage);
      // Show user-friendly message
    } else if (xhr.status === 404) {
      console.error('Endpoint not found.');
    }
  }
});

Prevention

When it happens

Trigger: The server returns an HTTP error status (500, 404, etc.) during an API module request. The XHR fail handler (api.js:558-592) fires with status 'error', and errorFromRequest returns this message if the response body has no structured error field.

Common situations: Server-side exceptions, incorrect endpoint URLs producing 404s, CORS rejections producing network errors, or the server returning non-JSON error pages (HTML error pages). The error message is generic because it is the fallback when no specific server error detail is available.

Related errors


AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13). Data as JSON: /api/errors/a1d2b1a71ff33283. Report an issue: GitHub.