> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endorlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# endorctl CLI exit codes

> Learn about the exit codes that you may encounter while using the endorctl CLI.

export const YamlTable = ({children, data: propData, content}) => {
  const KV_RE = /^([A-Za-z][A-Za-z0-9_()/#\s-]+?):\s*(.+)$/;
  const INLINE_MD_RE = /(\[([^\]]+)\]\(([^)]+)\))|(`([^`]+)`)|(\*\*([^*]+)\*\*)|(\*([^*]+)\*)/g;
  const YES_RE = /^-yes-$/i;
  const NO_RE = /^-no-$/i;
  const LIMITED_RE = /^-(limited|partial)-$/i;
  const NA_RE = /^-(na|none)-$/i;
  const NA2_RE = /^-na2-$/i;
  const SIMPLE_TAG_RE = /(<br\s*\/?>)|(<p\s*\/?>)|(-note-)|(-warning-)/gi;
  const tryParseKV = trimmed => {
    const m = KV_RE.exec(trimmed);
    return m ? {
      key: m[1],
      value: m[2].trim()
    } : null;
  };
  const registerKey = (key, seenKeys, orderedKeys) => {
    if (!seenKeys.has(key)) {
      orderedKeys.push(key);
      seenKeys.add(key);
    }
  };
  const flushEntry = (currentEntry, entries) => {
    if (Object.keys(currentEntry).length > 0) entries.push(currentEntry);
  };
  const parseDashPrefixed = (lines, entries, orderedKeys, seenKeys) => {
    let currentEntry = {};
    let inEntry = false;
    for (const line of lines) {
      const trimmed = line.trim();
      if (trimmed.startsWith('- ')) {
        if (inEntry) entries.push(currentEntry);
        currentEntry = {};
        inEntry = true;
        const kv = tryParseKV(trimmed.substring(2).trim());
        if (kv) {
          registerKey(kv.key, seenKeys, orderedKeys);
          currentEntry[kv.key] = kv.value;
        }
      } else if (inEntry && trimmed !== '') {
        const kv = tryParseKV(trimmed);
        if (kv) {
          registerKey(kv.key, seenKeys, orderedKeys);
          currentEntry[kv.key] = kv.value;
        }
      }
    }
    flushEntry(currentEntry, entries);
  };
  const parseBlankSeparated = (lines, entries, orderedKeys, seenKeys) => {
    let currentEntry = {};
    let inEntry = false;
    for (const line of lines) {
      const trimmed = line.trim();
      if (trimmed === '') {
        if (inEntry) {
          flushEntry(currentEntry, entries);
          currentEntry = {};
          inEntry = false;
        }
        continue;
      }
      const kv = tryParseKV(trimmed);
      if (!kv) continue;
      const isNewEntry = !line.startsWith(' ') && !line.startsWith('\t');
      if (isNewEntry && inEntry && Object.keys(currentEntry).length > 0) {
        entries.push(currentEntry);
        currentEntry = {};
      }
      registerKey(kv.key, seenKeys, orderedKeys);
      currentEntry[kv.key] = kv.value;
      inEntry = true;
    }
    flushEntry(currentEntry, entries);
  };
  const normalizeEntries = (entries, orderedKeys) => entries.map(entry => {
    const filled = {};
    for (const key of orderedKeys) filled[key] = entry[key] || '';
    return filled;
  });
  const parseYamlTableContent = contentStr => {
    if (!contentStr) return [];
    const entries = [];
    const orderedKeys = [];
    const seenKeys = new Set();
    const lines = contentStr.split('\n');
    if (lines.some(line => line.trim().startsWith('- '))) {
      parseDashPrefixed(lines, entries, orderedKeys, seenKeys);
    } else {
      parseBlankSeparated(lines, entries, orderedKeys, seenKeys);
    }
    return normalizeEntries(entries, orderedKeys);
  };
  const processText = text => {
    if (!text) return text;
    const parts = [];
    let keyIndex = 0;
    let lastIndex = 0;
    let match;
    while ((match = INLINE_MD_RE.exec(text)) !== null) {
      if (match.index > lastIndex) parts.push(text.slice(lastIndex, match.index));
      if (match[1]) {
        parts.push(<a key={keyIndex++} href={match[3]}>{match[2]}</a>);
      } else if (match[4]) {
        parts.push(<code key={keyIndex++}>{match[5]}</code>);
      } else if (match[6]) {
        parts.push(<strong key={keyIndex++}>{match[7]}</strong>);
      } else if (match[8]) {
        parts.push(<em key={keyIndex++}>{match[9]}</em>);
      }
      lastIndex = match.index + match[0].length;
    }
    if (lastIndex < text.length) parts.push(text.slice(lastIndex));
    if (parts.length === 0) return text;
    const keyRef = {
      current: keyIndex
    };
    return expandHtmlTags(parts, keyRef);
  };
  const processBadges = text => {
    if (!text || typeof text !== 'string') return text;
    if (YES_RE.test(text)) return <span className="yt-badge-yes" role="img" aria-label="Supported" title="Supported">✓</span>;
    if (NO_RE.test(text)) return <span className="yt-badge-no" role="img" aria-label="Not supported" title="Not supported">✗</span>;
    if (LIMITED_RE.test(text)) return <span className="yt-badge-limited" role="img" aria-label="Partially supported" title="Partially supported">◐</span>;
    if (NA_RE.test(text) || NA2_RE.test(text)) return <span className="yt-sr-only" title="Not applicable">Not applicable</span>;
    return processText(text);
  };
  const cellClassName = text => {
    if (!text || typeof text !== 'string') return undefined;
    if (NA_RE.test(text)) return 'yt-cell-na';
    if (NA2_RE.test(text)) return 'yt-cell-na2';
    return undefined;
  };
  const expandSimpleTags = (str, keyRef) => {
    const result = [];
    let last = 0;
    SIMPLE_TAG_RE.lastIndex = 0;
    let m;
    while ((m = SIMPLE_TAG_RE.exec(str)) !== null) {
      if (m.index > last) result.push(str.slice(last, m.index));
      if (m[1]) {
        result.push(<br key={keyRef.current++} />);
      } else if (m[2]) {
        result.push(<br key={keyRef.current++} />, <br key={keyRef.current++} />);
      } else if (m[3]) {
        result.push(<span key={keyRef.current++} className="yt-badge-note" style={{
          fontWeight: 600
        }}>Note: </span>);
      } else if (m[4]) {
        result.push(<span key={keyRef.current++} className="yt-badge-warning" style={{
          fontWeight: 600
        }}>Warning: </span>);
      }
      last = m.index + m[0].length;
    }
    if (last < str.length) result.push(str.slice(last));
    return result;
  };
  const expandHtmlTags = (chunks, keyRef) => {
    const out = [];
    for (const chunk of chunks) {
      if (typeof chunk === 'string') {
        out.push(...expandSimpleTags(chunk, keyRef));
      } else {
        out.push(chunk);
      }
    }
    return out;
  };
  const extractText = node => {
    if (node === null || node === undefined) return '';
    if (typeof node === 'string') return node;
    if (typeof node === 'number') return String(node);
    if (typeof node === 'boolean') return '';
    if (Array.isArray(node)) return node.map(extractText).join('');
    if (node && typeof node === 'object' && node.type) {
      const props = node.props || ({});
      if (typeof props.children === 'string') return props.children;
      if (props.children) return extractText(props.children);
      return '';
    }
    return String(node || '');
  };
  const [mounted, setMounted] = useState(false);
  useEffect(() => {
    setMounted(true);
  }, []);
  const data = useMemo(() => {
    if (propData) return propData;
    if (content && typeof content === 'string') return parseYamlTableContent(content);
    if (!children) return [];
    if (typeof children === 'string') return parseYamlTableContent(children);
    const childrenArray = Array.isArray(children) ? children : [children];
    return parseYamlTableContent(childrenArray.map(extractText).join('').trim());
  }, [children, propData, content]);
  const columns = useMemo(() => {
    if (!data || data.length === 0) return [];
    const firstRow = data[0];
    if (!firstRow || typeof firstRow !== 'object') return [];
    return Object.keys(firstRow);
  }, [data]);
  if (!mounted) return null;
  if (!data || data.length === 0) return null;
  const rowKey = row => columns.map(c => row[c] || '').join('|');
  return <table>
      <thead>
        <tr>
          {columns.map(col => <th key={col}>{col.replaceAll('_', ' ')}</th>)}
        </tr>
      </thead>
      <tbody>
        {data.map(row => <tr key={rowKey(row)}>
            {columns.map(col => <td key={col} className={cellClassName(row[col])}>{processBadges(row[col])}</td>)}
          </tr>)}
      </tbody>
    </table>;
};

The endorctl exit codes indicate whether the program completed successfully or encountered an error. This page documents the possible endorctl exit code values and the recommended next steps. When contacting support, provide the error code and the error message to help us debug the issue.

To get the exit code, run `echo $?` on the command line prompt.

<YamlTable>
  {`


    - Value: 2
    Exit_Code_Name: ENDORCTL_RC_ERROR
    Description: endorctl could not determine the exact cause of the error.
    - Value: 3
    Exit_Code_Name: ENDORCTL_RC_INVALID_ARGS
    Description: The command received an invalid argument. This may occur due to an invalid parameter value, or an incorrect package format.
    - Value: 4
    Exit_Code_Name: ENDORCTL_RC_ENDOR_AUTH_FAILURE
    Description: You don't have the correct permissions for this operation. Check your Endor Labs token or API keys to make sure they are valid and include the necessary permissions. Provide these using the \`--token\` flag or through the environment variables \`ENDOR_TOKEN\`, or \`ENDOR_API_CREDENTIALS_KEY/SECRET\`. The environment variables are mutually exclusive: you cannot have both a token and API keys set at the same time.
    - Value: 6
    Exit_Code_Name: ENDORCTL_RC_GITHUB_AUTH_FAILURE
    Description: You provided an empty or invalid GitHub token. Provide this token using the \`--scm-token\` flag or through the environment variable \`ENDOR_SCAN_SCM_TOKEN\`. You can skip the GitHub scan by not setting the \`--github\` flag.
    - Value: 7
    Exit_Code_Name: ENDORCTL_RC_ANALYTICS_ERROR
    Description: There was an error analyzing the dependencies.
    - Value: 8
    Exit_Code_Name: ENDORCTL_RC_FINDINGS_ERROR
    Description: There was an error generating findings based on the analytics output.
    - Value: 9
    Exit_Code_Name: ENDORCTL_RC_NOTIFICATIONS_ERROR
    Description: There was an error processing a notification triggered by a notification policy. See the error log for details and verify that you configured the corresponding notification target correctly.
    - Value: 10
    Exit_Code_Name: ENDORCTL_RC_GITHUB_API_ERROR
    Description: The GitHub API returned an error. This can occur due to GitHub rate-limiting or context deadline exceeded. Check the log message to see what object is causing the issue.
    - Value: 11
    Exit_Code_Name: ENDORCTL_RC_GITHUB_PERMISSIONS_ERROR
    Description: This error occurs when you authenticate with GitHub but lack the required permissions for the operation. You can't access the requested resource because of insufficient permissions. Check the GitHub token permissions, as well as the permissions and user accounts associated with the repository and/or organization and try again.
    - Value: 12
    Exit_Code_Name: ENDORCTL_RC_GIT_ERROR
    Description: A Git operation has failed. Examples of Git operations are: cloning, opening, finding the root, finding the HEAD, finding the default branch, and more. Ensure you are scanning the correct Git repository and that it is properly set up for the scan.
    - Value: 13
    Exit_Code_Name: ENDORCTL_RC_DEPENDENCY_RESOLUTION_ERROR
    Description: There was an error resolving the dependencies.
    - Value: 14
    Exit_Code_Name: ENDORCTL_RC_DEPENDENCY_SCANNING_ERROR
    Description: There was an error processing the resolved dependencies.
    - Value: 15
    Exit_Code_Name: ENDORCTL_RC_CALL_GRAPH_ERROR
    Description: There was an error generating the call graph.
    - Value: 16
    Exit_Code_Name: ENDORCTL_RC_LINTER_ERROR
    Description: There was an error while running the linters used to analyze the source code. This can affect secret and vulnerability detection.
    - Value: 17
    Exit_Code_Name: ENDORCTL_RC_BAD_POLICY_TYPE
    Description: endorctl detected an invalid policy. This is not a fatal error, but endorctl did not process the policy. See log for details.
    - Value: 18
    Exit_Code_Name: ENDORCTL_RC_POLICY_ERROR
    Description: There was an error evaluating one or more policies. See log for details.
    - Value: 20
    Exit_Code_Name: ENDORCTL_RC_INTERNAL_ERROR
    Description: There was an internal error within endorctl. See log for details.
    - Value: 21
    Exit_Code_Name: ENDORCTL_RC_DEADLINE_EXCEEDED
    Description: The deadline expired before the operation could complete.
    - Value: 22
    Exit_Code_Name: ENDORCTL_RC_NOT_FOUND
    Description: The requested resource was not found.
    - Value: 23
    Exit_Code_Name: ENDORCTL_RC_ALREADY_EXISTS
    Description: An attempt to create an entity failed because a resource with the same key already exists.
    - Value: 24
    Exit_Code_Name: ENDORCTL_RC_UNAUTHENTICATED
    Description: The request does not have valid authentication credentials for the operation.
    - Value: 25
    Exit_Code_Name: ENDORCTL_RC_VULN_ERROR
    Description: There was an issue ingesting and processing vulnerability data. See log for details.
    - Value: 26
    Exit_Code_Name: ENDORCTL_RC_INITIALIZATION_ERROR
    Description: There was an error initializing the project or the repository. This can happen if the project ingestion token is missing, the project URL is invalid, or authorization failed. See log for details.
    - Value: 27
    Exit_Code_Name: ENDORCTL_RC_HOST_CHECK_FAILURE
    Description: The endorctl host-check failed. Host won't be able to run endorctl scan successfully. See log for details.
    - Value: 28
    Exit_Code_Name: ENDORCTL_RC_SBOM_IMPORT_ERROR
    Description: There was an error importing an SBOM. See log for details.
    - Value: 29
    Exit_Code_Name: ENDORCTL_RC_PRE_COMMIT_CHECK_FAILURE
    Description: The pre-commit-checks command discovered one or more leaked secrets. See log for details.
    - Value: 30
    Exit_Code_Name: ENDORCTL_RC_GH_ACTION_WORKFLOW_SCAN_FAILURE
    Description: There was an error scanning the GitHub action dependencies. See log for details.
    - Value: 31
    Exit_Code_Name: ENDORCTL_RC_FILE_ANALYTICS_ERROR
    Description: There was an error reading files for analytics processing. See log for details.
    - Value: 32
    Exit_Code_Name: ENDORCTL_RC_SIGNATURE_VERIFICATION_FAILURE
    Description: Signature verification failed. See log for details.
    - Value: 33
    Exit_Code_Name: ENDORCTL_RC_LICENSE_ERROR
    Description: The requested operation requires additional licensing. See log for details.
    - Value: 34
    Exit_Code_Name: ENDORCTL_RC_HUGGING_FACE_ERROR
    Description: There was an error running the HuggingFace scanner.
    - Value: 35
    Exit_Code_Name: ENDORCTL_RC_SAST_ERROR
    Description: There was an error running the SAST scanner.
    - Value: 36
    Exit_Code_Name: ENDORCTL_RC_ARTIFACT_OPERATION_FAILURE
    Description: An error occurred while performing an artifact operation.
    - Value: 37
    Exit_Code_Name: ENDORCTL_RC_SEGMENTATION_ERROR
    Description: There was an error during file segmentation.
    - Value: 38
    Exit_Code_Name: ENDORCTL_RC_TOOLCHAIN_ERROR
    Description: An error occurred during the process of generating toolchains. See log for details.
    - Value: 39
    Exit_Code_Name: ENDORCTL_RC_SANDBOX_ERROR
    Description: An error occurred during endorctl sandbox execution, possibly due to setup or dependency issues. See log for details.
    - Value: 40
    Exit_Code_Name: ENDORCTL_RC_RULE_SET_ERROR
    Description: An error occurred when importing rules. See logs for details.
    - Value: 128
    Exit_Code_Name: ENDORCTL_RC_POLICY_VIOLATION
    Description: The scan violated one or more blocking admission policies. See log for details.
    - Value: 129
    Exit_Code_Name: ENDORCTL_RC_POLICY_WARNING
    Description: The scan violated one or more warning admission policies. endorctl returns this code only when you set the \`--exit-on-policy-warning\` flag.
    - Value: 133
    Exit_Code_Name: ENDORCTL_RC_EXPORTER_WARNING
    Description: A warning occurred while trying to export data via the configured exporter. Check your exporter configuration, scan profile setup, and integration status.
    - Value: 135
    Exit_Code_Name: ENDORCTL_RC_DEPENDENCY_SETUP_WARNING
    Description: A non-fatal issue occurred while configuring the dependency resolution environment (for example, truststore setup for mTLS). The scan continued with a fallback configuration but may encounter issues resolving from certain repositories.


    `}
</YamlTable>
