Initial upload: CLI Explain Fix project with CI/CD workflow
This commit is contained in:
232
knowledge_base/patterns.yaml
Normal file
232
knowledge_base/patterns.yaml
Normal file
@@ -0,0 +1,232 @@
|
||||
patterns:
|
||||
python:
|
||||
- pattern: "No module named"
|
||||
error_type: ImportError
|
||||
what_happened: Python couldn't find the specified module.
|
||||
why_happened: The module you tried to import isn't installed or Python can't find it in the search path.
|
||||
how_to_fix:
|
||||
- Install the missing package: pip install package-name
|
||||
- Check your virtual environment is activated
|
||||
- Verify PYTHONPATH includes the module location
|
||||
- Check for typos in the module name
|
||||
severity: high
|
||||
|
||||
- pattern: "list index out of range"
|
||||
error_type: IndexError
|
||||
what_happened: You tried to access a list index that doesn't exist.
|
||||
why_happened: The index you specified is greater than or equal to the list length.
|
||||
how_to_fix:
|
||||
- Check the list length before accessing: len(my_list)
|
||||
- Remember Python uses 0-based indexing
|
||||
- Use negative indices to access from the end
|
||||
severity: medium
|
||||
|
||||
- pattern: "division by zero"
|
||||
error_type: ZeroDivisionError
|
||||
what_happened: You attempted to divide by zero.
|
||||
why_happened: Division and modulo operations don't allow zero as the divisor.
|
||||
how_to_fix:
|
||||
- Check if divisor could be zero before dividing
|
||||
- Add a condition to handle zero case
|
||||
severity: medium
|
||||
|
||||
- pattern: "cannot concatenate"
|
||||
error_type: TypeError
|
||||
what_happened: You tried to combine incompatible types.
|
||||
why_happened: Python doesn't know how to combine these types together.
|
||||
how_to_fix:
|
||||
- Convert values to the same type first
|
||||
- Use str() to convert numbers to strings
|
||||
- Use int() or float() to convert strings to numbers
|
||||
severity: medium
|
||||
|
||||
javascript:
|
||||
- pattern: "is not a function"
|
||||
error_type: TypeError
|
||||
what_happened: You tried to call something that isn't a function.
|
||||
why_happened: The value you're calling () on is not a function - it might be undefined, null, or another type.
|
||||
how_to_fix:
|
||||
- Check if the value is defined before calling
|
||||
- Use typeof to verify it's a function
|
||||
- Check for typos in the function name
|
||||
severity: high
|
||||
|
||||
- pattern: "is undefined"
|
||||
error_type: ReferenceError
|
||||
what_happened: You referenced a variable that is undefined.
|
||||
why_happened: The variable exists but hasn't been assigned a value.
|
||||
how_to_fix:
|
||||
- Initialize variables before using them
|
||||
- Check if variables are properly imported
|
||||
- Use null instead of undefined when appropriate
|
||||
severity: high
|
||||
|
||||
- pattern: "is not defined"
|
||||
error_type: ReferenceError
|
||||
what_happened: You referenced a variable that doesn't exist.
|
||||
why_happened: The variable name is not in scope or was never declared.
|
||||
how_to_fix:
|
||||
- Declare the variable with const, let, or var
|
||||
- Check for typos in the variable name
|
||||
- Ensure imports are working correctly
|
||||
severity: high
|
||||
|
||||
go:
|
||||
- pattern: "nil pointer dereference"
|
||||
error_type: panic
|
||||
what_happened: You tried to access a field or method on a nil pointer.
|
||||
why_happened: The pointer is nil and doesn't point to a valid object.
|
||||
how_to_fix:
|
||||
- Check if pointers are nil before dereferencing
|
||||
- Ensure structs are properly initialized
|
||||
- Use pointers only when necessary
|
||||
severity: critical
|
||||
|
||||
- pattern: "index out of range"
|
||||
error_type: panic
|
||||
what_happened: Array or slice index is out of bounds.
|
||||
why_happened: The index you specified is outside the valid range for the slice/array.
|
||||
how_to_fix:
|
||||
- Check the slice/array length before indexing
|
||||
- Use for range to iterate safely
|
||||
- Remember Go uses 0-based indexing
|
||||
severity: critical
|
||||
|
||||
rust:
|
||||
- pattern: "borrow checker"
|
||||
error_type: borrow_check_error
|
||||
what_happened: Rust's borrow checker prevented the operation.
|
||||
why_happened: You tried to have multiple mutable references or use a value after it was moved.
|
||||
how_to_fix:
|
||||
- Use references (&) instead of moving ownership
|
||||
- Clone the value if you need multiple owners
|
||||
- Use Rc/Arc for shared ownership
|
||||
- Restructure your code to respect ownership rules
|
||||
severity: high
|
||||
|
||||
- pattern: "trait bounds"
|
||||
error_type: trait_error
|
||||
what_happened: A type doesn't implement the required trait.
|
||||
why_happened: The type doesn't have the necessary trait implementation for the generic function.
|
||||
how_to_fix:
|
||||
- Derive the trait if possible: #[derive(Debug)]
|
||||
- Implement the trait for your type
|
||||
- Use trait bounds in generic functions
|
||||
severity: medium
|
||||
|
||||
cli:
|
||||
- pattern: "command not found"
|
||||
error_type: CommandNotFound
|
||||
what_happened: The command you tried to run doesn't exist.
|
||||
why_happened: The command is not installed or not in your PATH.
|
||||
how_to_fix:
|
||||
- Install the command/tool
|
||||
- Check the spelling of the command
|
||||
- Verify the command is in your PATH
|
||||
- Use which or whereis to locate the command
|
||||
severity: medium
|
||||
|
||||
- pattern: "permission denied"
|
||||
error_type: PermissionError
|
||||
what_happened: You don't have permission to perform this operation.
|
||||
why_happened: The file/folder permissions don't allow your user to access or modify it.
|
||||
how_to_fix:
|
||||
- Use chmod to change permissions
|
||||
- Use sudo for admin operations
|
||||
- Check ownership of the file/directory
|
||||
severity: high
|
||||
|
||||
- pattern: "no such file or directory"
|
||||
error_type: FileNotFound
|
||||
what_happened: The file or directory doesn't exist.
|
||||
why_happened: The path you specified doesn't exist or has a typo.
|
||||
how_to_fix:
|
||||
- Check the path for typos
|
||||
- Use absolute paths
|
||||
- Check if you're in the right directory
|
||||
severity: high
|
||||
|
||||
docker:
|
||||
- pattern: "connection refused"
|
||||
error_type: DockerConnectionError
|
||||
what_happened: Docker daemon is not responding.
|
||||
why_happened: The Docker daemon isn't running or you don't have permission to access it.
|
||||
how_to_fix:
|
||||
- Start Docker daemon: sudo systemctl start docker
|
||||
- Check Docker is running: docker info
|
||||
- Add user to docker group: sudo usermod -aG docker $USER
|
||||
severity: high
|
||||
|
||||
- pattern: "image not found"
|
||||
error_type: DockerImageNotFound
|
||||
what_happened: Docker couldn't find the specified image.
|
||||
why_happened: The image doesn't exist locally or in the configured registries.
|
||||
how_to_fix:
|
||||
- Pull the image: docker pull image-name
|
||||
- Check for typos in the image name
|
||||
- Verify the registry is accessible
|
||||
severity: medium
|
||||
|
||||
git:
|
||||
- pattern: "not a git repository"
|
||||
error_type: GitNotRepo
|
||||
what_happened: You're not inside a Git repository.
|
||||
why_happened: The current directory and its parents don't contain a .git folder.
|
||||
how_to_fix:
|
||||
- Navigate to a git repository directory
|
||||
- Initialize a new repo: git init
|
||||
- Clone a repository: git clone url
|
||||
severity: medium
|
||||
|
||||
- pattern: "would be overwritten"
|
||||
error_type: GitMergeConflict
|
||||
what_happened: Git would overwrite uncommitted changes.
|
||||
why_happened: You have local changes that would be lost by the operation.
|
||||
how_to_fix:
|
||||
- Commit your changes: git add . && git commit
|
||||
- Stash changes: git stash
|
||||
- Discard changes: git checkout -- .
|
||||
severity: medium
|
||||
|
||||
kubernetes:
|
||||
- pattern: "connection refused"
|
||||
error_type: K8sConnectionError
|
||||
what_happened: Can't connect to Kubernetes cluster.
|
||||
why_happened: kubectl can't reach the cluster - it might not be running or your kubeconfig is wrong.
|
||||
how_to_fix:
|
||||
- Check cluster is running
|
||||
- Verify kubeconfig: kubectl config view
|
||||
- Check context: kubectl config current-context
|
||||
- Ensure VPN/network access if remote cluster
|
||||
severity: high
|
||||
|
||||
- pattern: "not found"
|
||||
error_type: K8sResourceNotFound
|
||||
what_happened: The Kubernetes resource doesn't exist.
|
||||
why_happened: The resource name or type specified doesn't exist in the namespace.
|
||||
how_to_fix:
|
||||
- Check resource exists: kubectl get <resource-type>
|
||||
- Check you're in the right namespace: kubectl config view --minify
|
||||
- Verify resource name spelling
|
||||
severity: medium
|
||||
|
||||
npm:
|
||||
- pattern: "ENOENT"
|
||||
error_type: NPMError
|
||||
what_happened: A file or directory doesn't exist.
|
||||
why_happened: npm can't find the specified file or directory, often related to missing dependencies.
|
||||
how_to_fix:
|
||||
- Run npm install to install dependencies
|
||||
- Check package.json exists
|
||||
- Clear npm cache: npm cache clean --force
|
||||
severity: medium
|
||||
|
||||
- pattern: "EACCES"
|
||||
error_type: PermissionError
|
||||
what_happened: npm doesn't have permission to access files.
|
||||
why_happened: Permission issues with npm's cache or global packages directory.
|
||||
how_to_fix:
|
||||
- Fix npm permissions or use nvm
|
||||
- Or run with sudo (not recommended)
|
||||
- Change npm prefix to a writable directory
|
||||
severity: high
|
||||
Reference in New Issue
Block a user