{ "IndexError": { "trigger_function": "[1][2]", "explanation": "You tried to access an index that is outside the range of the list. Ensure the index is within the valid range." }, "SyntaxError": { "trigger_function": "exec('x === 2')", "explanation": "There's a syntax error in your code. Check for typos, misplaced operators, or other syntax issues." }, "KeyError": { "trigger_function": "{}['missing_key']", "explanation": "You tried to access a dictionary key that does not exist. Make sure the key is spelled correctly or check if it exists." }, "TypeError": { "trigger_function": "'string' + 1", "explanation": "You are trying to perform an operation on incompatible data types. Check the types of your variables." }, "ValueError": { "trigger_function": "int('string')", "explanation": "You passed an argument to a function that is of the right type but has an invalid value. Ensure the value is within the expected range." }, "AttributeError": { "trigger_function": "None.some_method()", "explanation": "You tried to access or call an attribute or method that does not exist in the object. Check if the attribute or method name is correct." }, "FileNotFoundError": { "trigger_function": "open('non_existent_file.txt')", "explanation": "The file you're trying to open does not exist. Check the file path and ensure the file exists." }, "ImportError": { "trigger_function": "__import__('non_existent_module')", "explanation": "You tried to import a module that could not be found or is not installed. Verify the module name and installation." }, "IndentationError": { "trigger_function": "exec('if True:\\nprint(\"IndentationError\")')", "explanation": "There is an issue with the indentation of your code. Python relies on proper indentation to define blocks of code." }, "MemoryError": { "trigger_function": "[0] * (10**10)", "explanation": "Your program has run out of memory. This can happen with very large data structures or infinite loops." }, "RecursionError": { "trigger_function": "(lambda f: f(f))(lambda f: f(f))", "explanation": "Your function has called itself too many times, leading to a stack overflow. Check for base cases in recursive functions." }, "StopIteration": { "trigger_function": "next(iter([]))", "explanation": "An iterator or generator has been exhausted, usually in a loop. Ensure you're not iterating beyond the available data." }, "OverflowError": { "trigger_function": "float('inf') * 2", "explanation": "A numerical operation has exceeded the limits of the numeric type. This often happens with very large numbers." }, "FileExistsError": { "trigger_function": "open('existing_file.txt', 'x')", "explanation": "The file you're trying to create already exists. Consider using a different file name or check if the file should be overwritten." }, "PermissionError": { "trigger_function": "open('/root/forbidden_file.txt')", "explanation": "You don't have the necessary permissions to perform the operation, such as reading from or writing to a file." }, "NotImplementedError": { "trigger_function": "raise NotImplementedError('This feature is not implemented yet.')", "explanation": "A method or function is defined but not implemented. This is often used as a placeholder to indicate that code is missing." }, "ConnectionError": { "trigger_function": "raise ConnectionError('Connection failed.')", "explanation": "There was an issue with network connectivity or communication, often occurring with external resources or services." }, "TimeoutError": { "trigger_function": "raise TimeoutError('Operation timed out.')", "explanation": "A network operation took too long to complete and has been stopped. This can happen with web requests or database operations." }, "AssertionError": { "trigger_function": "assert False, 'This is an assertion error.'", "explanation": "An assert statement failed. This usually indicates that a condition expected to be true was false." }, "EncodingError": { "trigger_function": "b'\\x80abc'.decode('utf-8')", "explanation": "There was an issue with character encoding when handling text data. Ensure the encoding matches the data being processed." }, "DecodingError": { "trigger_function": "b'\\x80abc'.decode('ascii')", "explanation": "An error occurred when trying to decode data, usually from bytes to a string. Check if the data format matches the expected encoding." }, "UnboundLocalError": { "trigger_function": "def test(): print(x); x = 1; test()", "explanation": "A local variable is referenced before it has been assigned a value. Ensure the variable is initialized before use." }, "GeneratorExit": { "trigger_function": "(x for x in range(10)).close()", "explanation": "A generator was closed or exhausted before completing its intended iteration. This may happen with generators or coroutines." }, "RuntimeError": { "trigger_function": "raise RuntimeError('This is a runtime error.')", "explanation": "An error that occurs during program execution. This is a broad category that includes various types of runtime issues." }, "FileClosedError": { "trigger_function": "f = open('temp.txt', 'w'); f.close(); f.write('data')", "explanation": "An operation was attempted on a file that has already been closed. Ensure the file is open before performing operations on it." }, "BufferError": { "trigger_function": "raise BufferError('Buffer error occurred.')", "explanation": "An operation was attempted on a buffer that has been released or is otherwise unavailable." }, "NotCallableError": { "trigger_function": "x = 5; x()", "explanation": "An attempt was made to call a non-callable object, such as a non-function or method." }, "NameClashError": { "trigger_function": "def test(): pass; test = 5", "explanation": "A name conflict occurred, often due to redefinition or improper scoping of variables or functions." }, "NoSuchFileError": { "trigger_function": "open('non_existent_file.txt')", "explanation": "The file you're trying to access does not exist at the specified location." }, "InconsistentUseOfTabsAndSpacesError": { "trigger_function": "exec('if True:\\n\\tprint(1)\\n print(2)')", "explanation": "There is a mix of tabs and spaces used for indentation, leading to inconsistencies in code blocks." }, "DeprecatedFeatureError": { "trigger_function": "import imp", "explanation": "You are using a feature or function that has been deprecated and may be removed in future versions." }, "ContextError": { "trigger_function": "raise RuntimeError('Context error occurred.')", "explanation": "An operation or function was used in an incorrect context, such as using an object outside its intended scope." }, "SyntaxWarning": { "trigger_function": "import warnings; warnings.warn('syntax warning', SyntaxWarning)", "explanation": "The code may not be strictly incorrect but contains constructs that are deprecated or may be problematic in future versions." }, "ValueTooLargeError": { "trigger_function": "import sys; sys.setrecursionlimit(10**6)", "explanation": "A numerical value exceeds the limits of the numeric type or data structure, such as exceeding the maximum integer size." }, "TypeHintError": { "trigger_function": "def func(x: int): pass; func('string')", "explanation": "A type hint or annotation does not match the actual type of the value. This often occurs with static type checkers like mypy." }, "DataLossError": { "trigger_function": "raise RuntimeError('Data loss occurred.')", "explanation": "An operation has resulted in the loss of data, such as truncating a file or discarding important information." }, "ExecutionError": { "trigger_function": "raise RuntimeError('Execution error occurred.')", "explanation": "A general error occurred during the execution of the program. This can include issues such as resource unavailability or OS errors." } }