{"record":{"id":"f6a416ceff5b031c","repo":"Semantic-Org/Semantic-UI","slug":"the-method-you-called-is-not-defined-f6a416","errorCode":null,"errorMessage":"The method you called is not defined","messagePattern":"The method you called is not defined","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/definitions/behaviors/api.js","lineNumber":1132,"sourceCode":"  // failed JSON success test\n  onFailure   : function(response, $module) {},\n\n  // server error\n  onError     : function(errorMessage, $module) {},\n\n  // request aborted\n  onAbort     : function(errorMessage, $module) {},\n\n  successTest : false,\n\n  // errors\n  error : {\n    beforeSend        : 'The before send function has aborted the request',\n    error             : 'There was an error with your request',\n    exitConditions    : 'API Request Aborted. Exit conditions met',\n    JSONParse         : 'JSON could not be parsed during error handling',\n    legacyParameters  : 'You are using legacy API success callback names',\n    method            : 'The method you called is not defined',\n    missingAction     : 'API action used but no url was defined',\n    missingSerialize  : 'jquery-serialize-object is required to add form data to an existing data object',\n    missingURL        : 'No URL specified for api event',\n    noReturnedValue   : 'The beforeSend callback must return a settings object, beforeSend ignored.',\n    noStorage         : 'Caching responses locally requires session storage',\n    parseError        : 'There was an error parsing your request',\n    requiredParameter : 'Missing a required URL parameter: ',\n    statusMessage     : 'Server gave an error: ',\n    timeout           : 'Your request timed out'\n  },\n\n  regExp  : {\n    required : /\\{\\$*[A-z0-9]+\\}/g,\n    optional : /\\{\\/\\$*[A-z0-9]+\\}/g,\n  },\n\n  className: {\n    loading : 'loading',","sourceCodeStart":1114,"sourceCodeEnd":1150,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/behaviors/api.js#L1114-L1150","documentation":"This error is logged by the API module's invoke function (api.js:942-985) when a method name passed to $('.element').api('nonexistent.method') does not match any property in the module object. The invoke function traverses the module object by splitting the query string on dots/periods and camelCasing; if no matching key is found at any depth, it logs this error. It is the API module equivalent of site.js's method-not-found error.","triggerScenarios":"Calling $('.el').api('nonexistent'), $('.el').api('set.loading.extra') where 'set.loading' exists but 'extra' does not, or any method name that does not exist in the API module's method map. Also triggered by typos in method invocations.","commonSituations":"Typographical errors, version differences where method names changed, calling a method from a different Semantic UI module on an API-initialized element, or copy-pasting deprecated API examples.","solutions":["Consult the Semantic UI API module documentation for the correct method name.","Inspect the module object at runtime to discover valid method names.","Ensure the element is actually initialized with the API module before calling methods."],"exampleFix":"// before\n$('.api-element').api('set.load'); // typo\n\n// after\n$('.api-element').api('set.loading');","handlingStrategy":"type-guard","validationCode":"// Validate method name before invoking on the API module\nvar apiMethods = ['query','abort','reset','set.loading','remove.loading','set.error','remove.error','get.request','get.xhr','is.loading','is.disabled','is.mocked','create.request','create.mockedXHR'];\nif (apiMethods.indexOf(methodName) !== -1) {\n  $('.el').api(methodName);\n} else {\n  console.warn('Unknown API method:', methodName);\n}","typeGuard":"// Type guard for API module methods\nfunction isValidApiMethod(name) {\n  // Split and traverse the module object dynamically\n  var parts = name.split(/[.\\s]/);\n  var obj = $('.el').data('module-api');\n  return parts.every(function(p) { return obj && (obj = obj[p]) !== undefined; });\n}","tryCatchPattern":null,"preventionTips":["Consult the API module documentation for valid method names.","Store method names as constants to avoid typos.","Verify the element is initialized with the API module before invoking methods."],"tags":["api","invoke","method-not-found","semantic-ui"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}