\n \n
\n \n
\n ",
"metrics": {
"length": 1087,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)",
"condition": "with_lesson",
"status": 200,
"content": "Based on the provided information, I will guide you through a step-by-step process to fix the error \"磁盘空间不足 / chroma_db_v4 CacheCleanup\" and verify its resolution.\n\n**Step 1: Quickly locate who occupies space**\n\nRun the following command to find out who is occupying space on your system:\n```bash\ndu -sh ~/.hermes/ 2/dev/null | sort -h\n```\nThis command will display the disk usage of the `.hermes` directory in human-readable format.\n\n**Step 2: Locate the chroma_db_v4 directory**\n\nRun the following command to find the path of the `chroma_db_v4` directory:\n```bash\ndu -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2/dev/null\n```\nThis command will display the disk usage of the `chroma_db_v4` directory in human-readable format.\n\n**Step 3: Clean up the chroma_db_v4 cache**\n\nRun the following command to clean up the `chroma_db_v4` cache:\n```bash\nCacheCleanup\n```\nThis command will clean up the `chroma_db_v4` cache.\n\n**Step 4: Verify the resolution**\n\nRun the following command to",
"metrics": {
"length": 969,
"commands": 3,
"command_list": [
"du -sh ~/.hermes/ 2/dev/null | sort -h",
"du -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2/dev/null",
"CacheCleanup"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)",
"condition": "plain",
"status": 200,
"content": "The error message \"磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)\" is a Chinese error message that translates to \"Disk space is insufficient / chroma_db_v4 CacheCleanup (disk-space-cleanup)\". This error typically occurs when the cache of the ChromaDB V4 plugin is too large and exceeds the available disk space.\n\nHere's a concrete, actionable fix with exact commands to resolve this issue:\n\n**Method 1: Delete cache files manually**\n\n1. Open the Command Prompt or Terminal as an administrator.\n2. Navigate to the directory where the ChromaDB V4 plugin is installed (usually `C:\\Program Files\\ChromaDB V4` or `/usr/local/chroma_db_v4`).\n3. Run the following command to delete the cache files:\n```bash\nrm -rf chroma_db_v4_cache/*\n```\n**Method 2: Clear cache using the plugin's settings**\n\n1. Open the ChromaDB V4 plugin and go to Settings > Advanced Settings.\n2. Look for the \"Cache Cleanup\" or \"Disk Space Cleanup\" option and select it.\n3. Choose the frequency for the cache cleanup (e.g., \"Daily\" or \"Weekly\").\n4. Click \"Apply\"",
"metrics": {
"length": 1036,
"commands": 1,
"command_list": [
"rm -rf chroma_db_v4_cache/*"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"scenario": "curl / wget 请求失败通用Diagnosis (curl-request-troubleshoot)",
"condition": "with_lesson",
"status": 200,
"content": "To troubleshoot the `curl` request failure, follow these steps with exact commands:\n\n### 1. Check DNS Resolution\n\nFirst, ensure that the domain name can be resolved to an IP address. You can use `nslookup` or `dig` for this:\n\n```bash\nnslookup example.com\n```\nor\n```bash\ndig example.com\n```\n\nIf the domain resolves correctly, you should see an IP address returned. If not, you may have a DNS issue.\n\n### 2. Check Network Connectivity (Bypassing Proxy)\n\nTry connecting to the server without using a proxy to see if the issue is related to your proxy settings:\n\n```bash\ncurl -v --noproxy \"\" https://example.com\n```\n\nIf this command can connect but times out, it might indicate a firewall or proxy issue.\n\n### 3. Check Certificate Validation\n\nCertificate issues can cause `curl` to fail. Check the certificate validation:\n\n```bash\ncurl -v https://example.com\n```\n\nIf you encounter an SSL certificate problem, you can temporarily bypass certificate validation for testing purposes (not recommended for production):\n\n```bash\ncurl -k https://example.com\n```\n\n### 4. Check Proxy Settings\n\nView your current proxy settings:\n\n```",
"metrics": {
"length": 1119,
"commands": 5,
"command_list": [
"nslookup example.com",
"dig example.com",
"curl -v --noproxy \"\" https://example.com",
"curl -v https://example.com",
"curl -k https://example.com"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 14,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Erreur de permission Docker: permission denied sur /var/run/docker.sock (erreur-permission-docker-linux)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the \"permission denied\" error when trying to run Docker commands on Linux, follow these steps:\n\n**Step 1: Check if the docker group exists**\n\nOpen a terminal and run the following command to check if the docker group exists:\n\n```bash\ngrep docker /etc/group\n```\n\nIf the group does not exist, proceed to Step 2.\n\n**Step 2: Create the docker group if it does not exist**\n\nIf the docker group does not exist, create it using the following command:\n\n```bash\nsudo groupadd docker\n```\n\n**Step 3: Add your user to the docker group**\n\nAdd your user to the docker group using the following command:\n\n```bash\nsudo usermod -aG docker $USER\n```\n\nReplace `$USER` with your actual username.\n\n**Step 4: Activate the group change**\n\nLog out of your current session and log back in. Alternatively, you can run the following command to activate the group change:\n\n```bash\nnewgrp docker\n```\n\n**Step 5: Verify the fix (optional)**\n\nIf you want to verify that the fix was successful, run the following command:\n\n```bash\ngrep docker /etc/group\n```\n\nIf the fix was successful, the output should indicate that",
"metrics": {
"length": 1091,
"commands": 5,
"command_list": [
"grep docker /etc/group",
"sudo groupadd docker",
"sudo usermod -aG docker $USER",
"newgrp docker",
"grep docker /etc/group"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"scenario": "DCO Signoff Lost During Force Push (dco-signoff-force-push-pitfall)",
"condition": "plain",
"status": 200,
"content": "To fix the \"DCO Signoff Lost During Force Push\" issue, you can follow these steps. This problem occurs when you force push changes to a repository, potentially overwriting commits that included DCO (Developer Certificate of Origin) signoffs, which are crucial for verifying the origin and licensing of contributions.\n\nHere's how to handle the situation:\n\n### 1. Rebase Your Local Branch\n\nFirst, make sure you're on the branch you want to work on. Let's assume it's named `feature/new-feature`. If you've already force-pushed and lost DCO signoffs, you'll need to rebase your branch to reapply the DCO signoffs.\n\n```bash\n# Checkout your branch\ngit checkout feature/new-feature\n\n# Rebase interactively to edit commits\ngit rebase -i origin/main # Assuming 'main' is your upstream branch\n```\n\nIn the interactive rebase menu, you can choose to `edit` the commits where the DCO signoff was lost.\n\n### 2. Amend Commits to Add DCO Signoff\n\nFor each commit you want to edit, you'll amend it to add the DCO signoff. After selecting `edit` for a commit in the rebase menu, Git will pause",
"metrics": {
"length": 1077,
"commands": 2,
"command_list": [
"git checkout feature/new-feature",
"git rebase -i origin/main # Assuming 'main' is your upstream branch"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 4,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)",
"condition": "with_lesson",
"status": 200,
"content": "To address the \"磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)\" error, follow these steps. The goal is to free up disk space by cleaning up unnecessary files in `chroma_db_v4`, Hugging Face cache, temporary files, and log files.\n\n### Step 1: Identify Space Occupation\n\nFirst, identify which directories are occupying the most space:\n```bash\ndu -sh ~/.hermes/ 2>/dev/null | sort -h\ndu -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2>/dev/null\n```\n\n### Step 2: Clean Up `chroma_db_v4`\n\n1. **Backup `chroma_db_v4`**: Before making any changes, create a backup.\n ```bash\n cp -r /mnt/d/Eric/知识库/chroma_db_v4/ ~/chroma_db_v4_backup_$(date +%Y%m%d)\n ```\n2. **Check Versions**: List the versions of `chroma_db_v4` to decide which ones to keep.\n ```bash\n ls /mnt/d/Eric/知识库/chroma_db_v4/\n ```\n3. **Remove Old Versions**: Decide which versions",
"metrics": {
"length": 842,
"commands": 4,
"command_list": [
"du -sh ~/.hermes/ 2>/dev/null | sort -h",
"du -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2>/dev/null",
"cp -r /mnt/d/Eric/知识库/chroma_db_v4/ ~/chroma_db_v4_backup_$(date +%Y%m%d)",
"ls /mnt/d/Eric/知识库/chroma_db_v4/"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 9,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)",
"condition": "plain",
"status": 200,
"content": "To address the \"磁盘空间不足\" (insufficient disk space) error related to `chroma_db_v4 CacheCleanup` (disk-space-cleanup), you'll need to free up disk space. Here's a step-by-step guide to help you resolve this issue. Please note, the exact commands might vary slightly depending on your operating system (the instructions below are tailored for a Linux-based system, which is common for servers and databases).\n\n### 1. Check Available Disk Space\n\nFirst, check how much disk space is available and which partitions are running low. Open a terminal and run:\n\n```bash\ndf -h\n```\n\nThis command will show you the available disk space on your system.\n\n### 2. Identify Large Files and Directories\n\nTo find large files or directories that might be consuming a lot of space, use:\n\n```bash\nsudo du -h --max-depth=1 /\n```\n\nThis command scans the root directory and its immediate subdirectories for large files and directories. You might need to wait a bit for it to complete.\n\n### 3. Clean Up Package Cache (if applicable)\n\nIf you're using a Debian-based system (like Ubuntu), you can clean up the package cache to free up some space:\n\n```bash\nsudo",
"metrics": {
"length": 1131,
"commands": 2,
"command_list": [
"df -h",
"sudo du -h --max-depth=1 /"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Erreur de permission Docker: permission denied sur /var/run/docker.sock (erreur-permission-docker-linux)",
"condition": "plain",
"status": 200,
"content": "The error you're experiencing is due to a lack of permissions to access the Docker socket. Here's a step-by-step solution:\n\n**Step 1: Check the current permissions**\n\nRun the following command to check the current permissions of the Docker socket:\n```bash\nls -l /var/run/docker.sock\n```\nThis will display the current permissions of the socket.\n\n**Step 2: Add your user to the Docker group**\n\nTo access the Docker socket, you need to add your user to the Docker group. Run the following command:\n```bash\nsudo usermod -aG docker $USER\n```\nThis command adds your user to the Docker group.\n\n**Step 3: Log out and log back in**\n\nAfter adding your user to the Docker group, you need to log out and log back in to apply the changes.\n\n**Step 4: Verify the permissions**\n\nAfter logging back in, run the following command to verify the permissions of the Docker socket:\n```bash\nls -l /var/run/docker.sock\n```\nThis should display the updated permissions.\n\n**Step 5: Test Docker**\n\nFinally, test Docker by running the following command:\n```bash\ndocker run hello-world\n```\nThis command should run successfully if you have the necessary permissions",
"metrics": {
"length": 1134,
"commands": 4,
"command_list": [
"ls -l /var/run/docker.sock",
"sudo usermod -aG docker $USER",
"ls -l /var/run/docker.sock",
"docker run hello-world"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Erro de push rejeitado no Git: branches divergentes e como resolver (erro-push-git-rejeitado-divergente)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a concrete, actionable fix for the error \"branches divergentes e como resolver (erro-push-git-rejeitado-divergente)\" with exact commands:\n\n**Step 1: Pull the latest changes from the remote repository**\n\nOpen your terminal and navigate to your local repository. Run the following command to pull the latest changes from the remote repository:\n```bash\ngit pull origin main\n```\nThis command will fetch the latest changes from the remote repository and merge them into your local branch.\n\n**Step 2: Resolve any merge conflicts**\n\nIf there are any merge conflicts, Git will show you the conflicting files. Open the file in a text editor and manually resolve the conflicts. You can use a tool like `git mergetool` to help you resolve conflicts.\n\nOnce you've resolved the conflicts, add the file to the staging area and commit the changes:\n```bash\ngit add arquivo.txt\ngit commit -m \"Resolve merge conflicts with origin/main\"\n```\n**Step 3: Push the updated changes to the remote repository**\n\nNow that you've resolved any merge conflicts, you can push the updated changes to the remote repository:\n```bash\ngit push origin main\n```\nThis command will update the remote repository with your latest changes.\n\nAlternatively,",
"metrics": {
"length": 1218,
"commands": 4,
"command_list": [
"git pull origin main",
"git add arquivo.txt",
"git commit -m \"Resolve merge conflicts with origin/main\"",
"git push origin main"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Erro de push rejeitado no Git: branches divergentes e como resolver (erro-push-git-rejeitado-divergente)",
"condition": "plain",
"status": 200,
"content": "O erro \"branches divergentes\" ocorre quando você tenta push para um branch que não está em sincronia com a branch remota. Aqui está uma solução passo a passo:\n\n**Passo 1: Verifique a situação atual**\n\n```bash\ngit status\n```\n\nIsso mostrará quais branches estão em sincronia e quais estão divergentes.\n\n**Passo 2: Resolva a divergência**\n\nExistem várias formas de resolver a divergência, dependendo da situação. Aqui estão algumas opções:\n\n### 1. Rebase (reorganize os commits)\n\n```bash\ngit rebase -i HEAD~n\n```\n\nSubstitua `n` pelo número de commits que você deseja reorganizar. Isso irá reorganizar os commits para que eles sejam mais linhosos e em ordem cronológica.\n\n### 2. Merge (unir os branches)\n\n```bash\ngit merge branch-remota\n```\n\nSubstitua `branch-remota` pelo nome do branch remoto que você deseja unir.\n\n### 3. Reset (redefinir o HEAD)\n\n```bash\ngit",
"metrics": {
"length": 858,
"commands": 3,
"command_list": [
"git status",
"git rebase -i HEAD~n",
"git merge branch-remota"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 8,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Error de DCO sign-off en commits de Git en Windows (error-dco-signoff-windows)",
"condition": "plain",
"status": 200,
"content": "The \"error-dco-signoff-windows\" error typically occurs when you're trying to commit changes to a Git repository on Windows and the `dco` (Distributed Commit Options) sign-off check fails. This check ensures that all files have a valid DCO sign-off.\n\nTo fix this issue, you'll need to add a DCO sign-off to all files that are missing it. Here are the steps:\n\n1. **Check for missing DCO sign-off**:\n\n Open a Git Bash terminal and navigate to your repository directory. Then, run the following command to check which files are missing a DCO sign-off:\n\n ```bash\ngit diff --name-only --diff-filter=ACMRTUXB\n```\n\n This command will show you the files that have been modified (A), added (C), renamed (R), copied (M), or deleted (D), but do not have a DCO sign-off.\n\n2. **Add DCO sign-off to missing files**:\n\n Once you have identified the missing files, you can add a DCO sign-off to them using the following command:\n\n ```bash\ngit add -u\n```\n\n This command will stage all changes, including the ones without a DCO sign-off.\n\n",
"metrics": {
"length": 1031,
"commands": 2,
"command_list": [
"git diff --name-only --diff-filter=ACMRTUXB",
"git add -u"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 4,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Error de DCO sign-off en commits de Git en Windows (error-dco-signoff-windows)",
"condition": "with_lesson",
"status": 200,
"content": "El error de DCO sign-off en commits de Git en Windows se debe a varias causas, como la configuración de usuario no establecida, el entorno mixto y la diferencia entre mayúsculas y minúsculas en el email. Aquí te presento una serie de pasos y comandos para solucionar este problema:\n\n**Paso 1: Verificar la configuración actual**\n\n Primero, debemos verificar la configuración actual de Git en nuestro sistema. Para hacer esto, podemos utilizar el comando `git config --list --show-origin` con el parámetro `user`. Esto nos mostrará la configuración de usuario actual en cada nivel (sistema, global y local).\n\n```bash\ngit config --list --show-origin user\n```\n\n**Paso 2: Establecer la configuración de usuario**\n\n Para establecer la configuración de usuario, debemos configurar las variables `user.name` y `user.email` en cada nivel (sistema, global y local). Podemos hacer esto utilizando el comando `git config`.\n\n Primero, configuramos la variable `user.name`:\n\n```bash\ngit config --global user.name \"Tu Nombre\"\n```\n\n Luego, configuramos",
"metrics": {
"length": 1037,
"commands": 2,
"command_list": [
"git config --list --show-origin user",
"git config --global user.name \"Tu Nombre\""
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 9,
"lesson_hits": 2,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC Backup Payload Extraction — .VR/.SV Binary Parsing and .LS Text Fallback (fanuc-backup-payload-extraction)",
"condition": "with_lesson",
"status": 200,
"content": "To extract the payload configuration from a FANUC robot backup directory, you can follow these steps:\n\n**Step 1: Install WinOLPC**\n\nFirst, you need to install WinOLPC, which includes the kconvars.exe tool. You can download WinOLPC from the official FANUC website.\n\n**Step 2: Set up robot.ini**\n\nCreate a `robot.ini` file in the root directory of the backup directory. This file is required by the kconvars.exe tool. The contents of the file are as follows:\n```ini\n[DEFAULT]\nBinPath=C:\\path\\to\\kconvars.exe\n```\nReplace `C:\\path\\to\\kconvars.exe` with the actual path to the kconvars.exe executable.\n\n**Step 3: Extract payload configuration using kconvars.exe**\n\nOpen a Command Prompt or PowerShell and navigate to the root directory of the backup directory. Run the following command to extract the payload configuration:\n```bash\nkconvars.exe -p -l\n```\nThis command will extract the payload configuration from the backup directory and display it in the Command Prompt or PowerShell.\n\n**Step 4: Parse the output**\n\nThe output of the kconvars.exe command will be a series of lines",
"metrics": {
"length": 1076,
"commands": 3,
"command_list": [
"Replace `C:\\path\\to\\kconvars.exe` with the actual path to the kconvars.exe executable.",
"**Step 3: Extract payload configuration using kconvars.exe**",
"Open a Command Prompt or PowerShell and navigate to the root directory of the backup directory. Run the following command to extract the payload configuration:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC Backup Payload Extraction — .VR/.SV Binary Parsing and .LS Text Fallback (fanuc-backup-payload-extraction)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely related to the FANUC Backup Payload Extraction tool, which is used to extract data from FANUC backup files. Here's a step-by-step guide to fix the issue:\n\n**Error Analysis:**\n\nThe error message `.VR/.SV Binary Parsing and .LS Text Fallback` suggests that the tool is having trouble parsing the binary data in the `.VR` or `.SV` files. This could be due to a corrupted file or an incompatible version of the tool.\n\n**Fix:**\n\nTo resolve the issue, try the following steps:\n\n1. **Update the FANUC Backup Payload Extraction tool:**\n\n ```bash\nsudo apt update\nsudo apt install -y fanuc-backup-payload-extraction\n```\n\n or\n\n ```bash\nsudo yum update\nsudo yum install -y fanuc-backup-payload-extraction\n```\n\n or\n\n ```bash\nsudo pip install fanuc-backup-payload-extraction\n```\n\n2. **Check the file format:**\n\n Verify that the `.VR` or `.SV` files are in the correct format. You can use the `file` command to check the file type:\n\n ```bash\nfile -b *.vr\nfile -b",
"metrics": {
"length": 1001,
"commands": 5,
"command_list": [
"sudo apt update",
"sudo apt install -y fanuc-backup-payload-extraction",
"sudo yum update",
"sudo yum install -y fanuc-backup-payload-extraction",
"sudo pip install fanuc-backup-payload-extraction"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 12,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug (fanuc-intp-102-detect-joint-olp-whitespace)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug, follow these steps:\n\n**Step 1: Compare .ls Files**\n\nExtract the `.ls` file from the robot controller and compare it with the OLP-generated version.\n\n```bash\n# Extract the .ls file from the robot controller\nscp robot_original.ls user@server:/path/to/robot/ls\n\n# Compare the .ls files\ndiff robot_original.ls olp_generated.ls\n```\n\n**Step 2: Fix Trailing Whitespace**\n\nRemove extra spaces before semicolons in sensor instructions. Use the following command to fix the trailing whitespace:\n\n```bash\n# Use sed to remove trailing whitespace before semicolons\nsed -i 's/ ;/ ;/g' /path/to/robot/ls\n```\n\nReplace `/path/to/robot/ls` with the actual path to your `.ls` file.\n\n**Step 3: Report to OLP Vendor**\n\nFile a bug with RoboDK (or your OLP tool) about trailing whitespace in sensor instruction generation.\n\n```bash\n# Create a new issue in RoboDK\ncurl -X POST \\\n https://example.com/robodk/issues \\\n -",
"metrics": {
"length": 958,
"commands": 3,
"command_list": [
"scp robot_original.ls user@server:/path/to/robot/ls",
"diff robot_original.ls olp_generated.ls",
"sed -i 's/ ;/ ;/g' /path/to/robot/ls"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug (fanuc-intp-102-detect-joint-olp-whitespace)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to a whitespace bug in the FANUC INTP-102's OLP (Optical Linear Position) system. This issue can be fixed by updating the OLP system's firmware. Here's a step-by-step guide to help you resolve the problem:\n\n**Prerequisites:**\n\n* Make sure you have a FANUC INTP-102 robot with an OLP system installed.\n* Ensure that the robot's firmware is up-to-date. You can check the current firmware version using the `FANUC Robot Controller` software.\n* Familiarize yourself with the robot's safety features and operating procedures.\n\n**Fixing the OLP Whitespace Bug:**\n\n1. **Update the OLP system's firmware:**\n - Open the `FANUC Robot Controller` software and navigate to the `Maintenance` tab.\n - Select the `OLP` system and click on the `Update` button.\n - Follow the on-screen instructions to download and install the latest firmware for the OLP system.\n\n Example command:\n ```bash\n # Update OLP system firmware\n FANUC-INTP-102-OLP-Update\n ```\n\n2. **Verify the firmware update:**\n ",
"metrics": {
"length": 1031,
"commands": 1,
"command_list": [
"FANUC-INTP-102-OLP-Update"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 6,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC IO Marker M[] Instruction — Background Logic Alternative (fanuc-io-marker-m-instruction)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to enable the Marker register by setting `$MIX_LOGIC.$USE_MKR = TRUE` in your FANUC program. Here are the steps:\n\n1. Open your FANUC program in the FANUC HandlingTool.\n2. Go to `MENU → I/O → I/O Replace`.\n3. In the I/O Replace menu, click on the \"M[]\" option.\n4. Since the M[] option is not documented in standard TP programming guides, you will need to enable the Marker register by setting `$MIX_LOGIC.$USE_MKR = TRUE` in the program.\n5. Add the following code to your program: `$MIX_LOGIC.$USE_MKR = TRUE;`\n6. Save your changes and restart the FANUC program.\n\nHere's an example of how to set a Marker register:\n\n```fanuc\n-- Enable Marker register\n$MIX_LOGIC.$USE_MKR = TRUE;\n\n-- Set Marker register M[1]\nM[1] = (DI[1] AND DI[2]);\n```\n\nIn this example, the Marker register M[1] is set to true if both DI[1] and DI[2] are true.\n\nNote: The `$MIX",
"metrics": {
"length": 872,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC IO Marker M[] Instruction — Background Logic Alternative (fanuc-io-marker-m-instruction)",
"condition": "plain",
"status": 200,
"content": "The error message \"FANUC IO Marker M[] Instruction — Background Logic Alternative\" is not a standard error message, and it's likely a custom error message specific to your FANUC machine or your organization's configuration.\n\nHowever, I can provide you with some general steps to troubleshoot and resolve common issues related to FANUC IO Marker M[] instructions. Please note that these steps are based on general knowledge and may not be specific to your situation.\n\n**Step 1: Check the FANUC machine settings**\n\n1. Log in to the FANUC machine and navigate to the \"Machine Settings\" or \"Configuration\" menu.\n2. Check if the \"IO Marker\" or \"M[]\" settings are enabled and configured correctly.\n3. Verify that the \"Background Logic Alternative\" setting is not causing any issues.\n\n**Step 2: Check the program code**\n\n1. Check the program code for any errors or inconsistencies related to the IO Marker M[] instruction.\n2. Verify that the program code is correctly configured to use the IO Marker M[] instruction.\n3. Check for any errors or warnings related to the IO Marker M[] instruction in the program code.\n\n**Step 3: Check the FANUC machine logs**\n\n1. Check the FAN",
"metrics": {
"length": 1167,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 0,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC MI Standard Software — Complete Instruction Reference (MI01-MI22) (fanuc-mi-standard-software-instructions)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely related to the FANUC MI Standard Software, and I'll provide a general solution. However, please note that without the specific error message, it's difficult to provide an exact fix.\n\nAssuming the error is related to a configuration issue or a missing library, here are some general steps you can try:\n\n**Step 1: Check the software version**\n\nMake sure you're running the latest version of the FANUC MI Standard Software. You can check the version by running the following command:\n\n```bash\nmi_version\n```\n\n**Step 2: Check for missing libraries**\n\nRun the following command to check for missing libraries:\n\n```bash\nmi_libraries\n```\n\nThis will display a list of installed libraries. If you find any missing libraries, you can install them using the following command:\n\n```bash\nmi_install_library
\n```\n\nReplace `` with the name of the missing library.\n\n**Step 3: Check configuration files**\n\nCheck the configuration files for any errors or inconsistencies. Run the following command to display the configuration files:\n\n```bash\nmi_config\n```\n\nThis will display a list of configuration files. You can then edit these files manually to resolve any errors or inconsistencies.\n\n**Step",
"metrics": {
"length": 1245,
"commands": 4,
"command_list": [
"mi_version",
"mi_libraries",
"mi_install_library ",
"mi_config"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC MI Standard Software — Complete Instruction Reference (MI01-MI22) (fanuc-mi-standard-software-instructions)",
"condition": "with_lesson",
"status": 200,
"content": "Based on the provided information, the error is likely due to the incorrect usage of the CALL MIxx_MOD(parameters) instruction. The correct format for the CALL instruction is:\n\nCALL MIxx_MOD(parameters)\n\nHowever, in the provided instruction, the parameters are not enclosed in parentheses.\n\nHere is a concrete, actionable fix with exact commands:\n\nReplace the following instruction:\n\nCALL MI01_CMN(CollZone, Request/Release, ZoneNo.=1, '...')\n\nWith:\n\nCALL MI01_CMN(CollZone, Request/Release, 1, '...')\n\nAnd also replace the following instruction:\n\nCALL MI01_CMN(FestoCheck, '...')\n\nWith:\n\nCALL MI01_CMN(FestoCheck, '...') // No change needed here\n\nThe corrected instruction is:\n\nCALL MI01_CMN(CollZone, Request/Release, 1, '...')\n\nThis fix assumes that the zone number is always 1. If the zone number is dynamic, you should replace the number 1 with the actual zone number.\n\nSimilarly, for the MI02_TCH module, the instruction is:\n\n| Instruction | Function | Format\n|-------------|----------|--------|\n| Init | Reset tool change; check tool change; verify MI03 installation | CALL MI02",
"metrics": {
"length": 1086,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC R-2000iC 检索混淆Fix — 关键词强制召回 (fanuc-r-2000ic-retrieval-fix)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to add a keyword recovery module to the `retrieve()` function in `rag_core.py`. Here's the updated code:\n\n1. Open the `rag_core.py` file in your favorite text editor.\n2. Add the following code before the `type_model()` function:\n```python\nimport re\n\n_KW = re.compile(r'上位机|robot interface|寄存器读|寄存器写|读写寄存器', re.I)\n\ndef keyword_recovery(query):\n if _KW.search(query):\n kw_results = collection.get(\n where_document={\"$contains\": \"Robot Interface\"},\n limit=10,\n )\n for doc, meta in zip(kw_results[\"documents\"], kw_results[\"metadatas\"]):\n score = 0.92 if \"Robot Interface\" in doc[:500] else 0.85\n return score\n return 0.0\n\ndef retrieve(query):\n # ... (rest of the function remains the same)\n score = keyword_recovery(query)\n if score > 0.85:\n # ... (rest of the function remains the same)\n```\n3. Save the changes to the `rag_core.py` file.\n4. Run the",
"metrics": {
"length": 959,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC R-2000iC 检索混淆Fix — 关键词强制召回 (fanuc-r-2000ic-retrieval-fix)",
"condition": "plain",
"status": 200,
"content": "The error message \"FANUC R-2000iC 检索混淆Fix — 关键词强制召回 (fanuc-r-2000ic-retrieval-fix)\" is a Chinese error message, but I'll provide a general solution for a similar issue that might occur in Fanuc R-2000iC programming.\n\nThe error is likely related to a keyword conflict or undefined keyword in your program. Here's a step-by-step fix:\n\n**Step 1: Check your program for keyword conflicts**\n\n Review your program to ensure that you're not using a keyword as a variable or label name. Fanuc R-2000iC uses specific keywords for programming, such as `MOV`, `ADD`, `SUB`, etc. If you're using a keyword as a variable name, it may cause a conflict.\n\n**Step 2: Check for undefined keywords**\n\n Verify that all the keywords you're using are defined in your program or in the library. You can check the Fanuc R-2000iC documentation or online resources to ensure that the keyword is valid.\n\n**Step 3: Update your program**\n\nIf you've identified a keyword conflict or undefined keyword, update your program to use a different name or define the keyword.\n\n",
"metrics": {
"length": 1040,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC Spot Weld Tip Max Wear Amount — sysspot.sv Variable Lookup via kconvars (fanuc-spot-wear-max-lookup)",
"condition": "plain",
"status": 200,
"content": "The error message you're encountering is due to an invalid variable lookup in the FANUC Spot Welding system. To resolve this issue, you need to update the `fanuc-spot-wear-max-lookup` variable with the correct value.\n\nHere are the steps to fix this issue:\n\n**Method 1: Update the variable through the FANUC System**\n\n1. Open the FANUC System.\n2. Go to the \"Parameter\" menu.\n3. Select \"Variable\" and then \"Lookup\".\n4. In the \"Lookup\" window, select \"fanuc-spot-wear-max-lookup\" from the list of variables.\n5. Update the value in the \"Value\" field to the correct maximum wear amount.\n6. Click \"OK\" to save the changes.\n\n**Method 2: Update the variable through the FANUC kConVars**\n\n1. Open the FANUC kConVars.\n2. In the \"Variables\" section, find the \"fanuc-spot-wear-max-lookup\" variable.\n3. Update the value in the \"Value\" field to the correct maximum wear amount.\n4. Click \"OK\" to save the changes.\n\n**Method 3: Update the variable through the FANUC System Configuration**\n\n1.",
"metrics": {
"length": 976,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 1,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "FANUC Spot Weld Tip Max Wear Amount — sysspot.sv Variable Lookup via kconvars (fanuc-spot-wear-max-lookup)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the FANUC Spot Weld Tip Max Wear Amount error, follow these steps:\n\n**Step 1: Locate the sysspot.sv file**\n\n```bash\ncd \nls -l sysspot.sv\n```\n\n**Step 2: Convert the sysspot.sv file with kconvars**\n\n```bash\nkconvars.exe sysspot.sv sysspot_decoded.txt\n```\n\nNote: Make sure the `kconvars.exe` tool is in the same directory or parent as the `sysspot.sv` file. If it's not, you can specify the full path to `kconvars.exe`:\n\n```bash\nkconvars.exe path/to/kconvars.exe sysspot.sv sysspot_decoded.txt\n```\n\n**Step 3: Find the wear parameter**\n\n```bash\ncat sysspot_decoded.txt | grep $SPOTEQSETUP[1].$EPAF_TRGDST\n```\n\nThis command searches for the line containing `$SPOTEQSETUP[1].$EPAF_TRGDST` in the `sysspot_decoded.txt` file.\n\n**Step 4: Extract the maximum wear amount (",
"metrics": {
"length": 783,
"commands": 5,
"command_list": [
"cd ",
"ls -l sysspot.sv",
"kconvars.exe sysspot.sv sysspot_decoded.txt",
"kconvars.exe path/to/kconvars.exe sysspot.sv sysspot_decoded.txt",
"cat sysspot_decoded.txt | grep $SPOTEQSETUP[1].$EPAF_TRGDST"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 12,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"scenario": "DCO Signoff Lost During Force Push (dco-signoff-force-push-pitfall)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the \"DCO Signoff Lost During Force Push\" issue, follow these steps:\n\n1. **Reset your branch to the upstream main branch**:\n ```bash\ngit fetch upstream main\ngit reset --hard upstream/main\n```\n\n2. **Cherry-pick your commit with the `--signoff` option**:\n Replace `` with the actual hash of the commit you want to cherry-pick:\n ```bash\ngit cherry-pick --signoff\n```\n\n3. **Force push your changes to your fork**:\n Replace `fork` with the name of your fork and `branch` with the name of your branch:\n ```bash\ngit push fork branch --force\n```\n\n**Verification**:\nTo ensure that your PR only contains one commit and that the DCO signoff is present, you can use the following commands:\n\n1. **Check the number of commits in your PR**:\n Replace `UPSTREAM` with the name of the upstream repository, `REPO` with the name of the repository, and `NUMBER` with the number of your PR:\n ```bash\ngh api repos/UPSTREAM/REPO/pulls/NUMBER/commits --jq '",
"metrics": {
"length": 979,
"commands": 4,
"command_list": [
"git fetch upstream main",
"git reset --hard upstream/main",
"git cherry-pick --signoff",
"git push fork branch --force"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 13,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Fatal-guard CLI: harden entry point with --help, --version, exit codes (fatal-guard-cli-hardening)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a concrete, actionable fix for the given error:\n\n**Step 1: Install `argparse` if not already installed**\n\nOpen your terminal and run the following command to install `argparse` if it's not already installed:\n```bash\npip install argparse\n```\n**Step 2: Create a new file for your CLI tool**\n\nCreate a new file, e.g., `fatal-guard-cli.py`, and add the following code:\n```python\nimport argparse\nimport sys\n\n__version__ = \"1.4.2\"\n\ndef build_parser():\n parser = argparse.ArgumentParser(\n prog=\"fatal-guard\",\n description=\"Monitor and guard critical processes against fatal failures.\",\n epilog=\"Exit codes: 0=success, 1=guard failure, 2=usage error, 3=timeout\",\n )\n parser.add_argument(\n \"--version\", action=\"version\", version=f\"%(prog)s {__version__}\"\n )\n parser.add_argument(\n \"--timeout\",\n type=int,\n default=30,\n metavar=\"SECONDS\",\n help=\"Maximum seconds to wait for a guarded process to respond (default: 30)\",\n )\n parser.add_argument(\n \"--config\",\n type=str,\n default=\"/",
"metrics": {
"length": 1081,
"commands": 1,
"command_list": [
"pip install argparse"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 2,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Fatal-guard CLI: harden entry point with --help, --version, exit codes (fatal-guard-cli-hardening)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the hardening of entry points in Fatal-guard CLI. Here's a concrete, actionable fix:\n\n**Step 1: Install Fatal-guard CLI**\n\nFirst, make sure you have Fatal-guard CLI installed. If not, you can install it using the following command:\n\n```bash\npip install fatal-guard-cli\n```\n\n**Step 2: Hardening Entry Point**\n\nTo harden the entry point, you'll need to create a `hardening.toml` file in the root directory of your project. This file will contain the configuration for the hardening.\n\nHere's an example `hardening.toml` file:\n\n```toml\n[hardening]\nentry_points = [\n {\n name = \"fatal-guard-cli\"\n paths = [\n \"fatal-guard-cli --help\",\n \"fatal-guard-cli --version\",\n \"fatal-guard-cli exit\"\n ]\n }\n]\n```\n\n**Step 3: Configure Fatal-guard CLI**\n\nNext, you'll need to configure Fatal-guard CLI to use the `hardening.toml` file. You can do this by adding the following command to your `~/.bashrc` or `~/.bash_profile` file:\n\n```bash\nexport FATAL_GUARD_CONFIG=~/.",
"metrics": {
"length": 1018,
"commands": 3,
"command_list": [
"pip install fatal-guard-cli",
"**Step 3: Configure Fatal-guard CLI**",
"Next, you'll need to configure Fatal-guard CLI to use the `hardening.toml` file. You can do this by adding the following command to your `~/.bashrc` or `~/.bash_profile` file:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 2,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "ModuleNotFoundError in Python trotz pip install (fehler-python-modul-nicht-gefunden)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the `ModuleNotFoundError` in Python despite `pip install` succeeding, you need to ensure that the Python environment where `pip install` was run is the same as the environment executing the script. Here are the steps to follow:\n\n**Step 1: Identify the Python and pip versions in use**\n\nOpen a terminal and run the following commands to identify the Python and pip versions in use:\n```bash\n# Check the Python version\npython --version\n\n# Check the pip version\npip --version\n```\nTake note of the versions of Python and pip.\n\n**Step 2: Check if the Python and pip versions match**\n\nCompare the versions of Python and pip from the previous step. If they don't match, you may need to adjust the Python interpreter or pip version.\n\n**Step 3: Create a virtual environment (if not already created)**\n\nCreate a new virtual environment using the following command:\n```bash\npython -m venv myenv # Replace 'myenv' with your desired environment name\n```\n**Step 4: Activate the virtual environment**\n\nActivate the virtual environment using the following command:\n```bash\nsource myenv/bin/activate # On Linux/Mac\n. myenv\\Scripts\\activate # On Windows",
"metrics": {
"length": 1144,
"commands": 3,
"command_list": [
"python --version",
"pip --version",
"python -m venv myenv # Replace 'myenv' with your desired environment name"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "ModuleNotFoundError in Python trotz pip install (fehler-python-modul-nicht-gefunden)",
"condition": "plain",
"status": 200,
"content": "The error \"ModuleNotFoundError in Python trotz pip install\" usually occurs when the Python interpreter is unable to find the module that you're trying to import, even after installing it using pip. Here's a step-by-step solution to fix this issue:\n\n**Step 1: Update pip**\n\nBefore we proceed, make sure you're using the latest version of pip. Run the following command:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n**Step 2: Check for package name spelling mistake**\n\nDouble-check that the package name is spelled correctly. Make sure to use the exact same name as the package you're trying to install.\n\n**Step 3: Install the package using pip**\n\nTry installing the package again using pip:\n\n```bash\npython -m pip install python-modul\n```\n\nReplace `python-modul` with the actual name of the package you're trying to install.\n\n**Step 4: Check if the package is installed correctly**\n\nAfter installation, try importing the package again in your Python script:\n\n```python\nimport python_modul\n```\n\nIf the package is installed correctly, this command should not raise a ModuleNotFoundError.\n\n**Step 5: Check the Python path**\n\nIf the package is installed correctly, but still can't be",
"metrics": {
"length": 1183,
"commands": 2,
"command_list": [
"python -m pip install --upgrade pip",
"python -m pip install python-modul"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Feishu Block API returns code=0 but creates zero blocks under rate limiting (feishu-block-api-false-success)",
"condition": "plain",
"status": 200,
"content": "The error \"feishu-block-api-false-success\" typically indicates that the Feishu Block API is returning a successful response (code=0) but not actually creating any blocks due to rate limiting.\n\nTo fix this issue, you can try the following steps:\n\n1. **Increase the rate limit**: You can increase the rate limit by setting the `X-Feishu-Block-Api-Limit` header to a higher value. This will allow more requests to be made within a certain time frame.\n\n```bash\ncurl -X POST \\\n https://open.feishu.cn/open-apis/block/api/v1/blocks \\\n -H 'Content-Type: application/json' \\\n -H 'X-Feishu-Block-Api-Limit: 100' \\\n -d '{\"block_type\": \"text\", \"content\": \"Hello, world!\", \"trigger_type\": \"user\", \"trigger_value\": \"John\", \"trigger_operator\": \"==\"}'\n```\n\n2. **Wait for the rate limit reset**: If you're making requests too quickly, the rate limit might not have reset yet. You can wait for a few minutes and then try again.\n\n3. **Use a different block type**: Try using a different block",
"metrics": {
"length": 978,
"commands": 5,
"command_list": [
"curl -X POST \\",
"https://open.feishu.cn/open-apis/block/api/v1/blocks \\",
"-H 'Content-Type: application/json' \\",
"-H 'X-Feishu-Block-Api-Limit: 100' \\",
"-d '{\"block_type\": \"text\", \"content\": \"Hello, world!\", \"trigger_type\": \"user\", \"trigger_value\": \"John\", \"trigger_operator\": \"==\"}'"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Feishu Block API returns code=0 but creates zero blocks under rate limiting (feishu-block-api-false-success)",
"condition": "with_lesson",
"status": 200,
"content": "To fix this issue, you can add a validation step to ensure that the response contains actual block data. Here's a concrete, actionable fix:\n\n```bash\n# Update your script to include the validation step\nimport time\nimport requests\n\ndef create_blocks_safe(doc_id, parent_id, blocks, max_retries=3):\n \"\"\"Create blocks with rate limiting and body size limit checks\"\"\"\n \n # Initialize retry counter\n retries = 0\n \n while retries <= max_retries:\n try:\n # Send the POST request\n response = requests.post(\n f\"https://openapi.feishu.cn/open-apis/docx/v1/documents/{doc_id}/blocks/{parent_id}/children\",\n json=blocks,\n headers={\"Content-Type\": \"application/json\"},\n timeout=30\n )\n \n # Check if the response was successful\n if response.status_code == 200:\n # Parse the response JSON\n response_data = response.json()\n \n # Check if the response contains actual block data\n if \"children\" in response_data and len(response_data[\"children\"]) > 0:\n return True\n else:\n print(\"No blocks created. Response data:\", response_data)\n else:\n print",
"metrics": {
"length": 1327,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "feishu block batch limit (feishu-block-batch-limit)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you can modify the code to control the batch size and add a delay between batches. Here's an updated version of the code:\n\n```python\nimport time\n\ndef batch_create_blocks(client, doc_id, blocks):\n batch_size = 20\n interval = 0.5\n\n for i in range(0, len(blocks), batch_size):\n batch = blocks[i:i + batch_size]\n client.document.blocks.children.create(doc_id, children=batch)\n if i + batch_size < len(blocks):\n time.sleep(interval)\n\n# Usage\nblocks = [...] # your list of blocks\nbatch_create_blocks(client, doc_id, blocks)\n```\n\nHowever, this code still doesn't handle the case where the batch size exceeds the limit of 20 blocks. To handle this, you can add a check to ensure the batch size doesn't exceed 20:\n\n```python\nimport time\n\ndef batch_create_blocks(client, doc_id, blocks):\n max_batch_size = 20\n interval = 0.5\n\n for i in range(0, len(blocks), max_batch_size):\n batch = blocks[i:i + max_batch_size]\n if len(batch) < max_batch_size:\n client.document.blocks.children.create",
"metrics": {
"length": 1069,
"commands": 1,
"command_list": [
"However, this code still doesn't handle the case where the batch size exceeds the limit of 20 blocks. To handle this, you can add a check to ensure the batch size doesn't exceed 20:"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 2,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "feishu block batch limit (feishu-block-batch-limit)",
"condition": "plain",
"status": 200,
"content": "The error message \"feishu block batch limit (feishu-block-batch-limit)\" is related to the Feishu bot API, which has a limit on the number of batches you can send per second.\n\nTo fix this issue, you can try the following steps:\n\n1. **Increase the request rate limit**:\n You can increase the request rate limit by setting the `X-Feishu-Request-Rate-Limit` header to a higher value. You can do this by adding the following header to your request:\n ```bash\ncurl -X POST \\\n https://open.feishu.cn/open-apis/bot/v3/batchSend \\\n -H 'Authorization: Bearer YOUR_BOT_TOKEN' \\\n -H 'X-Feishu-Request-Rate-Limit: 1000' \\\n -H 'Content-Type: application/json' \\\n -d '[\n {\n \"type\": \"text\",\n \"text\": \"Hello, world!\"\n },\n {\n \"type\": \"text\",\n \"text\": \"This is a test message.\"\n }\n ]'\n```\n Replace `YOUR_BOT_TOKEN` with your actual bot token.\n\n2. **Use a queueing",
"metrics": {
"length": 905,
"commands": 15,
"command_list": [
"curl -X POST \\",
"https://open.feishu.cn/open-apis/bot/v3/batchSend \\",
"-H 'Authorization: Bearer YOUR_BOT_TOKEN' \\",
"-H 'X-Feishu-Request-Rate-Limit: 1000' \\",
"-H 'Content-Type: application/json' \\"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "feishu block type values limits (feishu-block-type-values-limits)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"feishu block type values limits (feishu-block-type-values-limits)\", you need to update your code to use the correct block type values and handle any potential issues with image tokens.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Update your JSON payload to use the correct block type values**\n\nReplace the following lines:\n```json\n{\n \"block_type\": 3,\n \"heading\": {\n \"level\": 3,\n \"elements\": [\n {\n \"type\": \"text_run\",\n \"text_run\": {\n \"content\": \"This is a heading\"\n }\n }\n ]\n }\n},\n{\n \"block_type\": 27,\n \"image\": {\n \"src\": \"https://example.com/image.jpg\"\n }\n}\n```\nWith the following updated lines:\n```json\n{\n \"block_type\": 1770001, // Use the correct heading type\n \"heading\": {\n \"level\": 3,\n \"elements\": [\n {\n \"type\": \"text_run\",\n \"text_run\": {\n \"content\": \"This is a heading\"\n }\n }\n ]\n }\n},\n{\n \"block_type\": 2,",
"metrics": {
"length": 952,
"commands": 1,
"command_list": [
"With the following updated lines:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "feishu block type values limits (feishu-block-type-values-limits)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to Feishu block type values limits. To resolve this issue, you'll need to update the block type values limits in your Feishu configuration.\n\nHere's a step-by-step guide to fix the issue:\n\n**Prerequisites:**\n\n* You have the Feishu SDK installed in your project.\n* You have a Feishu workspace set up.\n\n**Fix:**\n\n1. **Update the block type values limits in the Feishu configuration file:**\n\n If you're using a YAML configuration file, open the file in a text editor and update the block type values limits as follows:\n\n ```yml\nblock_type_values_limits:\n - type: text\n values:\n - short\n - long\n - type: image\n values:\n - small\n - medium\n - large\n```\n\n If you're using a JSON configuration file, update the block type values limits as follows:\n\n ```json\n{\n \"block_type_values_limits\": [\n {\n \"type\": \"text\",\n \"values\": [\"short\", \"long\"]\n },\n {\n \"type\": \"image\",\n \"values\": [\"small\", \"medium\", \"large\"]\n }\n ",
"metrics": {
"length": 1015,
"commands": 1,
"command_list": [
"If you're using a JSON configuration file, update the block type values limits as follows:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Near-duplicate Feishu bot lessons: keep cc-connect, archive generic stub (feishu-bot-setup-complete)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you'll need to follow these steps:\n\n1. Move the old generic body to a new file in the `_archive` directory.\n2. Update the canonical setup guide to point to the new file.\n3. Create a decision lesson at the old path.\n\nHere are the exact commands to achieve this:\n\n```bash\n# Move the old generic body to a new file in the _archive directory\ngit mv lessons/contrib/cc-connect-feishu-setup-complete.md lessons/_archive/cc-connect-feishu-setup-complete.md\n\n# Update the canonical setup guide to point to the new file\ngit mv lessons/contrib/feishu-bot-setup-complete.md lessons/contrib/cc-connect-feishu-setup-complete.md\n\n# Create a decision lesson at the old path\necho \"# Feishu Bot Setup\" > lessons/contrib/feishu-bot-setup-complete.md\necho \"## Problem\" >> lessons/contrib/feishu-bot-setup-complete.md\necho \"## Cause\" >> lessons/contrib/feishu-bot-setup-complete.md\necho \"## Fix\" >> lessons/contrib/feishu-bot-setup-complete.md\necho \"## Verify\" >> lessons/contrib/feishu-bot-setup-complete.md\n\n# Add a see_also",
"metrics": {
"length": 1024,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 3,
"lesson_hit_rate": 0.6
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "飞书 doc_delete_blocks_by_range 不传 end 会删到文档末尾 (feishu-doc-delete-blocks-by-range-pitfall)",
"condition": "with_lesson",
"status": 200,
"content": "The error you're encountering is due to the fact that when you don't provide the `end` parameter in the `doc_delete_blocks_by_range` method, it will delete all remaining blocks in the document instead of stopping at the specified `start` index.\n\nTo fix this issue, you can modify your code to always provide the `end` parameter, even if it's set to `start + count`. Here's an example of how you can do this in Python:\n\n```python\nimport requests\n\n# Replace with your Feishu API token and document ID\ntoken = \"your_token\"\ndoc_id = \"your_doc_id\"\n\n# Define the start and end indices\nstart = 0\ncount = 5\n\n# Get the block IDs for the specified range\nresponse = requests.get(f\"https://open.feishu.cn/document_api/v1/document/{doc_id}/fetch?scope=block&start={start}&count={count}&keyword=&order=desc\")\nblock_ids = response.json()[\"data\"][\"block_ids\"]\n\n# Delete the blocks\nresponse = requests.post(f\"https://open.feishu.cn/document_api/v1/document/{doc_id}/delete_blocks_by_ids\", \n json={\"block_ids\": block_ids}, \n headers={\"Authorization\": f",
"metrics": {
"length": 1082,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Near-duplicate Feishu bot lessons: keep cc-connect, archive generic stub (feishu-bot-setup-complete)",
"condition": "plain",
"status": 200,
"content": "The error message you're seeing is related to duplicate Feishu bot lessons. To fix this, you'll need to delete the duplicate lessons. Here are the steps to follow:\n\n**Step 1: Delete the duplicate lesson**\n\nYou can delete the duplicate lesson by running the following command:\n\n```bash\nfeishu delete-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)\n```\n\nReplace `feishu-bot-setup-complete` with the actual name of the duplicate lesson.\n\n**Step 2: Verify the lesson is deleted**\n\nAfter deleting the lesson, you can verify that it's been removed by running the following command:\n\n```bash\nfeishu lessons\n```\n\nThis will list all your Feishu bot lessons. If the duplicate lesson is deleted, you should no longer see it in the list.\n\n**Step 3: Re-create the lesson (if necessary)**\n\nIf the lesson was deleted by mistake, you'll need to re-create it. You can re-create the lesson by running the following command:\n\n```bash\nfeishu create-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)\n```\n\nReplace `feishu-bot-setup-complete` with the actual",
"metrics": {
"length": 1111,
"commands": 3,
"command_list": [
"feishu delete-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)",
"feishu lessons",
"feishu create-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 0.4
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "飞书 doc_delete_blocks_by_range 不传 end 会删到文档末尾 (feishu-doc-delete-blocks-by-range-pitfall)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to the `end` parameter not being provided in the `doc_delete_blocks_by_range` API method of the Feishu SDK. This can lead to unintended deletion of blocks at the end of the document.\n\nTo fix this issue, you need to provide the `end` parameter with the correct value. Here's an example of how to do it:\n\n```python\nfrom feishu import *\n\n# Initialize the client\nclient = Client()\n\n# Define the document ID and the start and end positions of the block range\ndoc_id = \"your_document_id\"\nstart = 1\nend = 5\n\n# Define the request body\nbody = {\n \"doc_id\": doc_id,\n \"start\": start,\n \"end\": end\n}\n\n# Send the request\nresponse = client.doc.delete_blocks_by_range(body)\n\n# Check if the request was successful\nif response.status_code == 200:\n print(\"Blocks deleted successfully\")\nelse:\n print(\"Error deleting blocks:\", response.text)\n```\n\nIn the above code:\n\n* `doc_id` is the ID of the document where you want to delete blocks.\n* `start` and `end` are the positions of the block range that you want to",
"metrics": {
"length": 1044,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "飞书 bot 在群聊里静默吞消息 — gateway 与 adapter 双层 allowlist 陷阱 (feishu-gateway-group-policy-silently-drops-messages)",
"condition": "with_lesson",
"status": 200,
"content": "以下是修复错误的步骤:\n\n**步骤 1: 创建一个新文件 `feishu-allowlist-example.py`**\n\n```bash\ntouch feishu-allowlist-example.py\n```\n\n**步骤 2: 将以下代码写入 `feishu-allowlist-example.py`**\n\n```python\nimport os\nimport logging\n\nfrom hermes import Hermes\n\n# 使 logger 显示详细信息\nlogging.basicConfig(level=logging.INFO)\n\n# 读取 Hermes Agent 的配置文件\nconfig_file = 'config.yaml'\nconfig = Hermes().config\n\n# 读取环境变量\nenv_file = '.env'\nenv = Hermes().env\n\n# 使 adapter 支持 allowlist\nadapter_config = {\n 'feishu': {\n 'policy': 'allowlist',\n 'allowed_users': env.get('FEISHU_ALLOWED_USERS', '')\n }\n}\n\n# 使 gateway 支持 allowall\ngateway_config = {\n 'feishu': {\n 'allowed_chats': env.get('FEISHU_GROUP_ALLOWED_CHATS', '')\n }\n}\n\n# 使 GATEWAY_ALLOW_ALL_USERS=false\ngateway_config['feishu']['allow_all_users'] = False\n\n",
"metrics": {
"length": 788,
"commands": 1,
"command_list": [
"touch feishu-allowlist-example.py"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 4,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "飞书 bot 在群聊里静默吞消息 — gateway 与 adapter 双层 allowlist 陷阱 (feishu-gateway-group-policy-silently-drops-messages)",
"condition": "plain",
"status": 200,
"content": "The error message \"飞书 bot 在群聊里静默吞消息 — gateway 与 adapter 双层 allowlist 陷阱 (feishu-gateway-group-policy-silently-drops-messages)\" indicates that the Feishu bot is silently dropping messages in a group chat due to a configuration issue with the gateway and adapter layers.\n\nTo fix this issue, you can try the following steps:\n\n1. Check the Feishu dashboard for any updates or changes to the gateway and adapter configurations.\n2. Ensure that the `allowlist` configuration is set correctly for the bot. You can do this by checking the `feishu-gateway-group-policy-silently-drops-messages` log for any errors related to the `allowlist`.\n3. Update the `feishu-gateway` and `feishu-adapter` configurations to ensure that they are compatible with each other.\n\nHere are some exact commands you can use to troubleshoot and fix the issue:\n\n**Step 1: Check the Feishu dashboard**\n\nOpen the Feishu dashboard and navigate to the \"Gateway\" tab. Check if there are any updates or changes to the gateway configuration.\n\n**Step 2: Check the `allowlist` configuration**\n\nRun the following command to",
"metrics": {
"length": 1079,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "feishu markdown table not rendered (feishu-markdown-table-not-rendered)",
"condition": "plain",
"status": 200,
"content": "The error \"feishu markdown table not rendered\" is typically caused by a missing or incorrect markdown syntax for tables in the Feishu bot. Here's a concrete and actionable fix:\n\n**Fix:**\n\n1. **Check your markdown syntax**: Ensure that your table is formatted correctly using the following syntax:\n```markdown\n| Column 1 | Column 2 | Column 3 |\n|----------|----------|----------|\n| Cell 1 | Cell 2 | Cell 3 |\n|----------|----------|----------|\n| Cell 4 | Cell 5 | Cell 6 |\n```\nNote the pipe (`|`) characters separating the columns and rows.\n\n2. **Use the correct table syntax**: If you're using Feishu's `markdown_table` element, make sure to use the correct syntax:\n```javascript\n{\n \"markdown_table\": {\n \"title\": \"Example Table\",\n \"rows\": [\n [\"Cell 1\", \"Cell 2\", \"Cell 3\"],\n [\"Cell 4\", \"Cell 5\", \"Cell 6\"]\n ]\n }\n}\n```\n3. **Test your markdown table**: Before sending the message, test your markdown table using a markdown parser like Markdown.it",
"metrics": {
"length": 977,
"commands": 2,
"command_list": [
"Note the pipe (`|`) characters separating the columns and rows.",
"2. **Use the correct table syntax**: If you're using Feishu's `markdown_table` element, make sure to use the correct syntax:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "feishu markdown table not rendered (feishu-markdown-table-not-rendered)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the issue with the Feishu markdown table not rendering, you can use the following steps:\n\n1. Install the required Python package:\n\n```bash\npip install re\n```\n\n2. Create a new file named `optimize_markdown_style.py` and add the following code:\n\n```python\nimport re\n\ndef optimize_markdown_style(content: str) -> str:\n \"\"\"Feishu post middle markdown table render fix: use
', line)\n # Clean up extra
before and after spaces\n line = re.sub(r'\\s
before and after the line\n line = f'
{line}
'\n in_table = True\n else:\n in_table = False\n result.append(line)\n \n return '\\n'.join(result)\n```\n\n3. Run",
"metrics": {
"length": 1027,
"commands": 1,
"command_list": [
"pip install re"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 4,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Finding and fixing Ghostty's largest memory leak (finding-and-fixing-ghostty-s-largest-memory-leak)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the memory leak in Ghostty, you'll need to modify the `scrollback_pruning` function to properly handle non-standard pages. Here's a concrete, actionable fix with exact commands:\n\n**Ghostty Code Modification**\n\n```c\n// In ghostty/scrollback.c\n\n// Modify the scrollback_pruning function to properly handle non-standard pages\nvoid scrollback_prune(PageList *page_list) {\n // ... (rest of the function remains the same)\n\n // Check if the page is non-standard and needs to be destroyed\n if (page->mmap_len > PAGE_SIZE) {\n munmap(page->mmap, page->mmap_len);\n }\n\n // Allocate a fresh standard-sized page from the pool\n page = page_list->pool->alloc_page(PAGE_SIZE);\n if (page) {\n // ... (rest of the function remains the same)\n }\n}\n\n// Modify the page_list_destroy function to properly free non-standard pages\nvoid page_list_destroy(PageList *page_list) {\n // ... (rest of the function remains the same)\n\n // Check if the page is non-standard and needs to be destroyed\n if (page->mmap_len > PAGE_SIZE) {\n munmap",
"metrics": {
"length": 1066,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 1,
"lesson_hit_rate": 0.2
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "cc-connect Feishu bot complete setup guide (feishu-setup-complete-cc-connect)",
"condition": "plain",
"status": 200,
"content": "The error message \"cc-connect Feishu bot complete setup guide (feishu-setup-complete-cc-connect)\" suggests that there might be an issue with the Feishu bot setup or the connection to the Feishu platform.\n\nHere's a step-by-step guide to resolve this issue:\n\n**Step 1: Check your Feishu bot token**\n\n1. Open the Feishu platform and navigate to your bot's settings.\n2. Look for the \"Bot Token\" or \"API Token\" section.\n3. Make sure you have copied the bot token correctly.\n\n**Step 2: Update your `~/.cc` configuration file**\n\n1. Open a terminal and navigate to your home directory (`cd ~`).\n2. Run the following command to update the `~/.cc` configuration file:\n```\ncc config update\n```\n3. If you don't have a `~/.cc` file, create it with the following command:\n```\ncc config init\n```\n4. Update the Feishu bot token in the `~/.cc` file by running:\n```\ncc config set feishu.token \n```\nReplace `` with the actual bot token you copied from the Feishu",
"metrics": {
"length": 975,
"commands": 3,
"command_list": [
"cc config update",
"cc config init",
"cc config set feishu.token "
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "cc-connect Feishu bot complete setup guide (feishu-setup-complete-cc-connect)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a concrete, actionable fix for the error:\n\n1. **Update the `cc-connect` package to the latest version**:\n\n ```bash\nnpm install -g cc-connect@latest\n```\n\n2. **Create a configuration file for `cc-connect`**:\n\n ```bash\nmkdir -p ~/.cc-connect\ncp /path/to/cc-connect/config.example.toml ~/.cc-connect/config.toml\n```\n\n3. **Update the configuration file with the correct `app_id` and `app_secret`**:\n\n Replace `/path/to/your/project` with your actual project path.\n\n ```toml\n[[projects]]\nname = \"cc-connect-feishu\"\n\n[projects.agent]\ntype = \"claudecode\"\n\n[projects.agent.options]\nwork_dir = \"/path/to/your/project\"\nmode = \"default\"\n\n[[projects.platforms]]\ntype = \"feishu\"\n\n[projects.platforms.options]\napp_id = \"YOUR_APP_ID\"\napp_secret = \"YOUR_APP_SECRET\"\n\n```\n\n4. **Verify the installation and configuration**:\n\n ```bash\nnpm install -g cc-connect@latest\ncc-connect --version\n```\n\n5. **Display the optimized configuration**:\n\n ```bash\ncc-connect",
"metrics": {
"length": 968,
"commands": 5,
"command_list": [
"npm install -g cc-connect@latest",
"mkdir -p ~/.cc-connect",
"cp /path/to/cc-connect/config.example.toml ~/.cc-connect/config.toml",
"4. **Verify the installation and configuration**:",
"5. **Display the optimized configuration**:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 13,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Finding and fixing Ghostty's largest memory leak (finding-and-fixing-ghostty-s-largest-memory-leak)",
"condition": "plain",
"status": 200,
"content": "To fix Ghostty's largest memory leak, you'll need to identify the cause of the memory leak and then address it. Here are some general steps and concrete commands to help you get started:\n\n**Step 1: Identify the cause of the memory leak**\n\nYou can use the following command to get a list of processes that are consuming the most memory:\n```bash\nps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem\n```\nThis command will show you a list of processes, sorted by the amount of memory they are consuming.\n\n**Step 2: Analyze the memory usage**\n\nYou can use the `pmap` command to analyze the memory usage of a specific process:\n```bash\npmap -d \n```\nReplace `` with the ID of the process you want to analyze.\n\n**Step 3: Identify the memory leak**\n\nYou can use the `strace` command to analyze the system calls made by a process and identify the source of the memory leak:\n```bash\nstrace -s 1000 -p \n```\nThis command will show you a list of system calls made by the process, including the amount of memory used by each call.\n\n**Step",
"metrics": {
"length": 1048,
"commands": 3,
"command_list": [
"ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem",
"pmap -d ",
"strace -s 1000 -p "
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Frontmatter Parsing Edge Cases — Silent Failures and Data Loss (frontmatter-parsing-edge-cases)",
"condition": "with_lesson",
"status": 200,
"content": "The issue you're experiencing is due to the `extract_frontmatter` function not handling edge cases properly. Here's a concrete, actionable fix:\n\n**Step 1: Update the `extract_frontmatter` function**\n\n```python\nimport re\nimport json\nimport yaml\nfrom typing import Tuple\n\ndef extract_frontmatter(path: 'Path') -> Tuple[dict | None, str | None]:\n \"\"\"\n Extract frontmatter from a file.\n\n Args:\n path: The path to the file.\n\n Returns:\n A tuple containing the extracted frontmatter as a dictionary or None, and an error message or None.\n \"\"\"\n content = path.read_text(encoding=\"utf-8\")\n # Check for UTF-8 BOM encoding\n if content.startswith('\\ufeff'):\n content = content[1:]\n\n m = re.match(r\"^---\\s*\\n(.?)\\n---\", content, re.DOTALL)\n if not m:\n # Return empty dict for empty frontmatter blocks\n return {}, None\n\n raw = m.group(1).strip()\n try:\n # Try to parse as JSON\n fm = json.loads(raw)\n except json.JSONDecodeError:\n # Fall back to simple YAML-like parser",
"metrics": {
"length": 1040,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Game MCP: End Turn Returns 409 Conflict (game-mcp-end-turn-conflict-409)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"Game MCP: End Turn Returns 409 Conflict\", you can follow these steps:\n\n1. Send the `end_turn` command to the MCP endpoint.\n2. Check if the response is a 409 Conflict. If it is, ignore it and proceed with the next steps.\n3. Use the `get_state` command to query the current game state.\n4. Verify that the game state shows the next turn has started.\n\nHere are the exact commands:\n\n```bash\n# Send end_turn command\nend_turn\n\n# Check if the response is a 409 Conflict\nif [ $? -eq 409 ]; then\n # Ignore the 409 response and proceed with the next steps\n echo \"Ignoring 409 response\"\nelse\n echo \"Received non-409 response\"\nfi\n\n# Query game state\nget_state\n\n# Verify that the game state shows the next turn has started\nif [ \"$(get_state | jq -r '.turn')\" == \"next\" ]; then\n echo \"Game state shows next turn has started\"\nelse\n echo \"Game state does not show next turn has started\"\nfi\n```\n\nNote: The `jq` command is used to parse the JSON response from the `get_state` command.\n\n",
"metrics": {
"length": 990,
"commands": 12,
"command_list": [
"end_turn",
"if [ $? -eq 409 ]; then",
"echo \"Ignoring 409 response\"",
"else",
"echo \"Received non-409 response\""
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Game MCP: End Turn Returns 409 Conflict (game-mcp-end-turn-conflict-409)",
"condition": "plain",
"status": 200,
"content": "The error \"Game MCP: End Turn Returns 409 Conflict (game-mcp-end-turn-conflict-409)\" typically occurs when the MCP (Multiplayer Combat Protocol) is unable to update the game state because it has been modified by another player. This conflict can happen when multiple players try to end their turns simultaneously.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Wait for 30 seconds**\n\nThe MCP will retry updating the game state after a short delay. Wait for 30 seconds to see if the conflict resolves itself.\n\n**Step 2: Check for conflicting players**\n\nIf the conflict persists, check the game's chat or observer window to see if any other players are trying to end their turns. If you find another player attempting to end their turn, inform them of the conflict and ask them to wait until the game is updated.\n\n**Step 3: End your turn manually**\n\nIf the conflict persists, try ending your turn manually by typing `/endturn` in the chat window. This will force the game to update the state without relying on the MCP.\n\n**Step 4: Reconnect to the game**\n\nIf the conflict still persists, try reconnecting to the game. Sometimes, reconnecting can resolve the conflict and allow the MCP to update",
"metrics": {
"length": 1192,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Frontmatter Parsing Edge Cases — Silent Failures and Data Loss (frontmatter-parsing-edge-cases)",
"condition": "plain",
"status": 200,
"content": "The error \"Frontmatter Parsing Edge Cases — Silent Failures and Data Loss\" typically occurs when the `frontmatter-parsing-edge-cases` plugin is used in conjunction with other plugins that modify or delete frontmatter data. To resolve this issue, you can try the following steps:\n\n1. **Update the `frontmatter-parsing-edge-cases` plugin**:\n\n * If you're using npm or yarn, run the following command to update the plugin:\n\n ```bash\nnpm install --save-dev frontmatter-parsing-edge-cases@latest\n```\n\n or\n\n ```bash\nyarn add frontmatter-parsing-edge-cases@latest --dev\n```\n\n2. **Disable the `frontmatter-parsing-edge-cases` plugin temporarily**:\n\n * If the issue persists, try disabling the plugin temporarily by commenting out the line in your `package.json` file that enables it:\n\n ```json\n \"scripts\": {\n // ...\n \"build\": \"gatsby build --disable-plugin=frontmatter-parsing-edge-cases\",\n // ...\n },\n```\n\n Then, run the following command to build your site:\n\n ```bash\nnpm run build\n```\n\n or\n\n ```bash\ny",
"metrics": {
"length": 1085,
"commands": 4,
"command_list": [
"npm install --save-dev frontmatter-parsing-edge-cases@latest",
"yarn add frontmatter-parsing-edge-cases@latest --dev",
"Then, run the following command to build your site:",
"or"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 12,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Gateway 进程挂死未崩溃 — watchdog 自动Recovery (gateway-hang-watchdog-recovery)",
"condition": "with_lesson",
"status": 200,
"content": "根据给出的解决方案,这是解决 Gateway 进程挂死未崩溃的问题的具体步骤:\n\n1. **杀掉 TTY 里的 Hermes CLI过程**:\n\n ```bash\n pkill -f \"hermes cli\" || true\n ```\n\n 这个命令会杀掉 TTY 里的 Hermes CLI过程。如果 Hermes CLI过程存在,则会被杀掉。\n\n2. **通过 systemd 运行 Gateway**:\n\n ```bash\n systemctl --user status hermes-gateway.service\n ```\n\n 这个命令会检查 Gateway 服务是否通过 systemd 运行。如果服务没有运行,则会显示错误信息。\n\n3. **验证命令**:\n\n ```bash\n pkill -f \"hermes cli\" || true\n echo \"Verification passed: fix command exited 0\"\n ```\n\n 这个命令会杀掉 TTY 里的 Hermes CLI过程。如果 Hermes CLI过程存在,则会被杀掉。然后,会打印 \"Verification passed: fix command exited 0\" 的信息,表明命令执行成功。\n\n**具体步骤:**\n\n1. **使用命令 pkill -f \"hermes cli\" || true**:",
"metrics": {
"length": 648,
"commands": 4,
"command_list": [
"pkill -f \"hermes cli\" || true",
"systemctl --user status hermes-gateway.service",
"pkill -f \"hermes cli\" || true",
"echo \"Verification passed: fix command exited 0\""
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 3,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Gateway 进程挂死未崩溃 — watchdog 自动Recovery (gateway-hang-watchdog-recovery)",
"condition": "plain",
"status": 200,
"content": "The error message \"Gateway 进程挂死未崩溃 — watchdog 自动Recovery (gateway-hang-watchdog-recovery)\" is a common issue in Linux systems. This error occurs when the gateway process hangs and the watchdog timer fails to recover from it.\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Check the system logs**\n\nFirst, check the system logs to see if there are any error messages related to the gateway process.\n\n```bash\nsudo journalctl -u systemd-networkd\n```\n\nThis command will display the journal entries for the systemd-networkd service, which is responsible for managing network interfaces.\n\n**Step 2: Restart the gateway service**\n\nTry restarting the gateway service to see if it resolves the issue.\n\n```bash\nsudo systemctl restart gateway\n```\n\nor\n\n```bash\nsudo systemctl restart systemd-networkd\n```\n\n**Step 3: Disable and re-enable the gateway service**\n\nDisable the gateway service, wait for a few seconds, and then re-enable it.\n\n```bash\nsudo systemctl stop gateway\nsudo systemctl disable gateway\nsudo systemctl enable gateway\n```\n\n**Step 4: Check the watchdog configuration**\n\nCheck the watchdog configuration file to ensure it is set up correctly.\n\n```bash",
"metrics": {
"length": 1170,
"commands": 6,
"command_list": [
"sudo journalctl -u systemd-networkd",
"sudo systemctl restart gateway",
"sudo systemctl restart systemd-networkd",
"sudo systemctl stop gateway",
"sudo systemctl disable gateway"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 2,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GFW TLS SNI 阻断:工具层全部无效,只有代理能解 (gfw-tls-sni-blocking-tool-layer-ineffective)",
"condition": "plain",
"status": 200,
"content": "The error message \"GFW TLS SNI 阻断:工具层全部无效,只有代理能解\" indicates that the TLS SNI (Server Name Indication) is blocked by the Great Firewall of China (GFW), and only proxy servers can resolve it. Here's a concrete fix using a proxy server:\n\n**Method 1: Using a proxy server with a VPN**\n\n1. Install a VPN client on your device (e.g., TunnelBear, ExpressVPN, or NordVPN).\n2. Connect to a VPN server that bypasses the GFW (e.g., a server in the US or Canada).\n3. Configure your browser to use the VPN connection as the proxy server. The steps vary depending on your browser:\n\n**Google Chrome:**\n\n* Open Chrome settings (chrome://settings/)\n* Click on \"Advanced\"\n* Click on \"System\"\n* Click on \"Proxy settings\"\n* Select \"Use a proxy server\"\n* Enter the VPN server's IP address and port (e.g., `tunnelbear.com:8080`)\n* Click \"Save\"\n\n**Mozilla Firefox:**\n\n* Open Firefox settings (about:config)\n* Search for \"network.proxy.type\" and set it to 3 (System proxy)\n* Search for \"network",
"metrics": {
"length": 970,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Ghidra MCP Server — AI-Assisted Reverse Engineering (ghidra-mcp-server-reverse-engineering)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you'll need to install the Ghidra plugin and MCP server, and then connect from any MCP client. Here's a step-by-step guide:\n\n**Step 1: Install Ghidra plugin and MCP server**\n\n1. Clone the GhidraMCP repository:\n ```bash\ngit clone https://github.com/LaurieWired/GhidraMCP.git\n```\n\n2. Navigate to the cloned repository:\n ```bash\ncd GhidraMCP\n```\n\n3. Install the Ghidra plugin:\n ```bash\n./install-plugin.sh\n```\n\n4. Install the MCP server:\n ```bash\n./install-server.sh\n```\n\n5. Start the MCP server:\n ```bash\n./start-server.sh\n```\n\n**Step 2: Connect from any MCP client**\n\n1. Clone the MCP client repository (e.g., MCP-Client):\n ```bash\ngit clone https://github.com/LaurieWired/MCP-Client.git\n```\n\n2. Navigate to the cloned repository:\n ```bash\ncd MCP-Client\n```\n\n3. Build the MCP client:\n ```bash\n./build.sh\n```\n\n4. Connect to the MCP server:\n ```",
"metrics": {
"length": 878,
"commands": 8,
"command_list": [
"git clone https://github.com/LaurieWired/GhidraMCP.git",
"cd GhidraMCP",
"./install-plugin.sh",
"./install-server.sh",
"./start-server.sh"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 16,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GFW TLS SNI 阻断:工具层全部无效,只有代理能解 (gfw-tls-sni-blocking-tool-layer-ineffective)",
"condition": "with_lesson",
"status": 200,
"content": "解决GFW TLS SNI 阻断问题的步骤如下:\n\n**步骤 1: 安装 proxychains**\n\n由于 GFW 阻断了所有工具层,需要使用代理来解析。我们需要安装 `proxychains` 和 `tor`:\n\n```bash\nsudo apt-get update\nsudo apt-get install proxychains tor\n```\n\n**步骤 2: 配置 proxychains**\n\n编辑 `~/.proxychains.conf`文件:\n\n```bash\nsudo nano ~/.proxychains.conf\n```\n\n添加以下内容:\n\n```\nroot\n # No Tor connection\n 0 0.0.0.0 0.0.0.0 TOR\n```\n\n**步骤 3: 配置 tor**\n\n编辑 `~/.torrc`文件:\n\n```bash\nsudo nano ~/.torrc\n```\n\n添加以下内容:\n\n```\nControlPort 443\nListenAddress 127.0.0.1\n```\n\n**步骤 4: 启动 tor**\n\n```bash\nsudo systemctl start tor\n```\n\n**步骤 5: 配置 curl**\n\n编辑 `~/.curlrc`文件:\n\n```bash\nsudo nano ~/.curlrc\n",
"metrics": {
"length": 598,
"commands": 9,
"command_list": [
"sudo apt-get update",
"sudo apt-get install proxychains tor",
"sudo nano ~/.proxychains.conf",
"root",
"0 0.0.0.0 0.0.0.0 TOR"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 17,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Ghidra MCP Server — AI-Assisted Reverse Engineering (ghidra-mcp-server-reverse-engineering)",
"condition": "plain",
"status": 200,
"content": "I can help you troubleshoot the issue with Ghidra MCP Server. However, I need more information about the error message you're seeing. Could you please provide the exact error message you're encountering?\n\nThat being said, here are some common issues that might cause problems with Ghidra MCP Server:\n\n1. Missing dependencies:\nGhidra requires several dependencies to be installed on your system. Make sure that you have the following packages installed:\n\n - `libssl-dev` (for SSL support)\n - `libgmp-dev` (for arbitrary-precision arithmetic)\n - `liblzma-dev` (for LZMA compression)\n\n You can install these packages using the following commands:\n\n ```bash\nsudo apt-get update\nsudo apt-get install -y libssl-dev libgmp-dev liblzma-dev\n```\n\n2. Ghidra not installed:\n Make sure that Ghidra is installed on your system. You can install it using the following command:\n\n ```bash\nsudo apt-get install -y ghidra\n```\n\n3. MCP Server not running:\n If you're trying to use the MCP Server with Ghidra, make sure that it's running. You can start the MCP Server using the following command:\n\n",
"metrics": {
"length": 1092,
"commands": 3,
"command_list": [
"sudo apt-get update",
"sudo apt-get install -y libssl-dev libgmp-dev liblzma-dev",
"sudo apt-get install -y ghidra"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Чистая ветка после слияния предыдущего pull request (git-clean-branch-after-merged-pr-ru)",
"condition": "with_lesson",
"status": 200,
"content": "Чтобы решить эту проблему, нужно сделать следующее:\n\n1. Войти в исходную ветку `main` с помощью `git checkout main`.\n2. Сравнить HEAD с основной веткой `origin/main` с помощью `git log --oneline origin/main..HEAD`.\n3. Если есть конфликты, решить их с помощью `git merge --abort` и повторить шаги.\n4. Если все ок, то создать новую ветку с помощью `git switch -c docs/next-lesson` (или любая другая комбинация, используемая в вашем репозитории).\n\nHere's как это выглядит в терминале:\n\n```bash\n# Войти в исходную ветку main\ngit checkout main\n\n# Сравнить HEAD с основной веткой origin/main\ngit log --oneline origin/main..HEAD\n\n# Решить конфликты, если есть\ngit merge --abort\n\n# Повторить шаги, если все еще есть конфликты\ngit log --oneline origin/main..HEAD\n\n# Если все ок, то создать новую ветку\ngit switch -c docs/next-lesson\n```\n\nAlternatively, если вы хот",
"metrics": {
"length": 855,
"commands": 5,
"command_list": [
"git checkout main",
"git log --oneline origin/main..HEAD",
"git merge --abort",
"git log --oneline origin/main..HEAD",
"git switch -c docs/next-lesson"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Чистая ветка после слияния предыдущего pull request (git-clean-branch-after-merged-pr-ru)",
"condition": "plain",
"status": 200,
"content": "The error \"Чистая ветка после слияния предыдущего pull request (git-clean-branch-after-merged-pr-ru)\" is a Russian translation of a Git error that occurs when you try to delete a branch that has unmerged commits.\n\nTo fix this error, you need to use the following command:\n\n```bash\ngit merge --no-ff -m \"Clean up the branch\" \n```\n\nHere's what each part of the command does:\n\n- `git merge`: This command merges the current branch with another branch.\n- `--no-ff`: This option prevents the merge from being a fast-forward. When a merge is a fast-forward, Git doesn't create a new merge commit, but instead updates the tip of the current branch to point directly to the tip of the other branch.\n- `-m \"Clean up the branch\"`: This is the commit message for the merge commit. You can customize it as needed.\n- ``: Replace `` with the name of the branch you want to clean up.\n\nAfter running the command, you can then delete the branch:\n\n```bash\ngit branch -d \n```\n\nIf you want to force delete the branch (i.e",
"metrics": {
"length": 1053,
"commands": 2,
"command_list": [
"git merge --no-ff -m \"Clean up the branch\" ",
"git branch -d "
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "gh credential helper 路径Error导致 git push 静默失败 (git-credential-helper-gh-path-mismatch)",
"condition": "with_lesson",
"status": 200,
"content": "解决 gh credential helper 路径Error导致 git push 靜默失败的问题步骤如下:\n\n**步骤 1: 查看当前 credential helper 配置**\n\n```bash\ngit config --global --list | grep credential\n```\n\n**步骤 2: 移除路径错误的 gh credential helper**\n\n```bash\ngit config --global --unset-all credential.https://github.com.helper\ngit config --global --unset-all credential.https://gist.github.com.helper\n```\n\n**步骤 3: 确保保留正确的 credential store**\n\n```bash\ngit config --global credential.helper store\n```\n\n**步骤 4: 确认 .git-credentials 里有有效 token**\n\n```bash\ncat ~/.git-credentials\n```\n\n**步骤 5: 验证**\n\n```bash\ngit ls-remote origin HEAD\n```\n\n如果没有报错,说明解决方案成功。\n\n**步骤 6: 验证配置**\n\n```bash\ngit config --global --list | grep credential\necho \"Verification passed: fix command exited 0\"\n```\n\n如果没有报错,说明验证成功。",
"metrics": {
"length": 727,
"commands": 8,
"command_list": [
"git config --global --list | grep credential",
"git config --global --unset-all credential.https://github.com.helper",
"git config --global --unset-all credential.https://gist.github.com.helper",
"git config --global credential.helper store",
"cat ~/.git-credentials"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 11,
"lesson_hits": 2,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "gh credential helper 路径Error导致 git push 静默失败 (git-credential-helper-gh-path-mismatch)",
"condition": "plain",
"status": 200,
"content": "The error \"git-credential-helper-gh-path-mismatch\" occurs when the path to the GitHub credential helper is not correctly set. Here's a step-by-step fix:\n\n**Fix 1: Update the GitHub Credential Helper Path**\n\n1. Open your terminal or command prompt.\n2. Run the following command to update the path to the GitHub credential helper:\n ```bash\ngit config --global credential.helper path /usr/bin/git-credential-cache\n```\n If you're on Windows, replace `/usr/bin/git-credential-cache` with the path to the `git-credential-cache` executable on your system.\n\n**Fix 2: Verify the Path (Optional)**\n\n1. Run the following command to verify the path to the GitHub credential helper:\n ```bash\ngit config --global credential.helper path\n```\n This command should display the updated path.\n\n**Fix 3: Run `git push` Again**\n\n1. Try running `git push` again to see if the issue is resolved.\n\nIf you're still facing issues, you can try resetting the credential helper path to its default value:\n```bash\ngit config --global --unset credential.helper\n```\nThis will reset the credential helper path to its default value, which should resolve the issue",
"metrics": {
"length": 1136,
"commands": 3,
"command_list": [
"git config --global credential.helper path /usr/bin/git-credential-cache",
"git config --global credential.helper path",
"git config --global --unset credential.helper"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 2,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Git 凭证Setup — Automation push 免密码 (git-credentials-automation)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"Git 凭证Setup — Automation push 免密码\" when running a script that automates a git push, you can follow these steps:\n\n**Step 1: Configure Git to use a non-interactive credential helper**\n\nOpen your terminal and run the following command to configure Git to use a non-interactive credential helper:\n```bash\ngit config --global credential.helper store\n```\nThis will store your credentials in a file instead of prompting you for input.\n\n**Step 2: Create a file to store your credentials**\n\nCreate a file named `.git-credentials` in your home directory (e.g., `~/.git-credentials`) with the following contents:\n```bash\nhttps://username:${GITHUB_TOKEN}@github.com\n```\nReplace `username` with your actual GitHub username and `GITHUB_TOKEN` with your personal access token (more on this later).\n\n**Step 3: Test the configuration**\n\nRun the following command to test the configuration:\n```bash\ngit ls-remote https://github.com/your-org/your-repo.git\n```\nThis should return the HEAD reference without prompting you for input.\n\n**Verification**\n\nTo verify that the fix worked, run the following command:\n```bash\ngit config --global credential",
"metrics": {
"length": 1145,
"commands": 3,
"command_list": [
"git config --global credential.helper store",
"https://username:${GITHUB_TOKEN}@github.com",
"git ls-remote https://github.com/your-org/your-repo.git"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 5,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Git 凭证Setup — Automation push 免密码 (git-credentials-automation)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to Git not being able to find your credentials. To fix this, you can use the `git-credential-store` and `git credential store` commands to automate the process of storing your credentials. Here are the steps:\n\n**Step 1: Install the required packages**\n\nIf you're using a Linux or macOS system, you can install the required packages using the following commands:\n\n```bash\nsudo apt-get update\nsudo apt-get install git-credential-store\n```\n\nFor Windows, you can use the following commands:\n\n```bash\ngit config --global credential.helper store\ngit credential store --add --server https://github.com --username your-username --password your-password\n```\n\n**Step 2: Configure Git to use credential store**\n\nTo configure Git to use the credential store, you can run the following command:\n\n```bash\ngit config --global credential.helper store\n```\n\n**Step 3: Add your credentials to the credential store**\n\nTo add your credentials to the credential store, you can run the following command:\n\n```bash\ngit credential store --add --server https://github.com --username your-username --password your-password\n```\n\nReplace `your-username` and `your-password` with your",
"metrics": {
"length": 1198,
"commands": 6,
"command_list": [
"sudo apt-get update",
"sudo apt-get install git-credential-store",
"git config --global credential.helper store",
"git credential store --add --server https://github.com --username your-username --password your-password",
"git config --global credential.helper store"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 3,
"lesson_hit_rate": 0.6
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change (git-force-with-lease-detached-head)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change\" (git-force-with-lease-detached-head), you need to use `git push --force-with-lease` instead of `git push --force`. This command checks that the remote ref is still at the commit you expect before overwriting.\n\nHere are the exact steps to follow:\n\n1. First, pull the latest changes from the remote repository to ensure you have the most up-to-date information.\n\n```bash\ngit pull origin feat/foo\n```\n\n2. Then, force-push your changes using `git push --force-with-lease`.\n\n```bash\ngit push --force-with-lease origin feat/foo\n```\n\nBy using `--force-with-lease`, Git will check that the remote ref is still at the commit you expect before overwriting it. If someone else has pushed in the meantime, Git will reject the push with an error message.\n\nNote that if you're using a Git version older than 2.24, you won't have the `--force-with-lease` option. In that case, you can use `--force` with the `--no-verify` option to achieve similar behavior:\n\n```bash\ngit push origin feat/foo --",
"metrics": {
"length": 1067,
"commands": 2,
"command_list": [
"git pull origin feat/foo",
"git push --force-with-lease origin feat/foo"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change (git-force-with-lease-detached-head)",
"condition": "plain",
"status": 200,
"content": "The error \"Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change (git-force-with-lease-detached-head)\" occurs when you try to push a detached HEAD to a remote repository using the `--force-with-lease` option. This option is used to prevent accidental overwrites of remote branches.\n\nHere's a step-by-step fix:\n\n**Step 1: Identify the detached HEAD**\n\nFirst, check if your HEAD is detached:\n```bash\ngit status\n```\nThis will show you the current state of your repository. If your HEAD is detached, it should indicate that you're working on a new branch or have made changes to the current branch without checking out a new branch.\n\n**Step 2: Reset your HEAD to a valid branch**\n\nReset your HEAD to a valid branch, such as the master branch:\n```bash\ngit checkout master\n```\nAlternatively, you can reset your HEAD to the previous commit:\n```bash\ngit reset --hard HEAD~1\n```\nThis will move your HEAD to the previous commit, which should be a valid branch.\n\n**Step 3: Force-push your changes (if necessary)**\n\nIf you've made changes to your repository and want to push them to the remote repository, you'll need to",
"metrics": {
"length": 1123,
"commands": 3,
"command_list": [
"git status",
"git checkout master",
"git reset --hard HEAD~1"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Git 合并ConflictHandling — 手动解决最佳实践 (git-merge-conflict-resolution)",
"condition": "with_lesson",
"status": 200,
"content": "解决 Git 合并冲突时的最佳实践如下:\n\n**步骤 1:查看冲突文件**\n\n```bash\ngit status\n```\n\n**步骤 2:查看冲突的具体差异**\n\n```bash\ngit diff\n```\n\n**步骤 3:选择解决方法**\n\n### 3a. 快捷方式:直接选择某一方的完整版本\n\n```bash\ngit checkout --ours src/config.py\n```\n\n或\n\n```bash\ngit checkout --theirs src/config.py\n```\n\n这将保留当前分支(HEAD)的版本或合并进来的分支的版本。\n\n### 3b. 推荐方式:手动编辑,精确合并双方改动\n\n1. 打开编辑器,找到 <<<<<<< 标记。\n2. 手动决定最终内容。\n3. 删除 <<<<<<<、=======、>>>= 三行标记。\n4. 保存编辑。\n\n**步骤 4:确认文件中已无残留冲突标记**\n\n```bash\ngrep -rn \"<<<<<<\" src/\n```\n\n**步骤 5:标记为已解决**\n\n```bash\ngit add src/config.py\n",
"metrics": {
"length": 494,
"commands": 5,
"command_list": [
"git status",
"git diff",
"git checkout --ours src/config.py",
"git checkout --theirs src/config.py",
"grep -rn \"<<<<<<\" src/"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 10,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Git 合并ConflictHandling — 手动解决最佳实践 (git-merge-conflict-resolution)",
"condition": "plain",
"status": 200,
"content": "Git 合并 ConflictHandling 是一个常见的错误,下面是如何手动解决它的最佳实践:\n\n1. **停止工作**:使用 `git checkout --theirs` 或 `git checkout --ours` 来停止工作并保留一个版本。\n\n ```bash\ngit checkout --theirs <文件名>\n```\n\n 或者\n\n ```bash\ngit checkout --ours <文件名>\n```\n\n2. **手动修改**:打开 conflicts.txt 文件并手动修改它。\n\n 例如:\n\n ```markdown\n# conflicts.txt\n<<<<<<< HEAD\n\n=======\n\n\n>>>>>>> current-branch-name\n```\n\n 例如:\n\n ```markdown\n# conflicts.txt\n<<<<<<< HEAD\n\n<<<<<<< HEAD\n\n>>>>>>> current-branch-name\n```\n\n3. **保存并提交**:使用 `git add` 和 `git commit` 来保存并提交修改。\n\n ```bash\ngit add .\ngit commit -m \"手动解决合并冲突\"\n```\n\n4. **合并**:使用 `git merge` 来合并两个分支。\n\n ",
"metrics": {
"length": 775,
"commands": 4,
"command_list": [
"git checkout --theirs <文件名>",
"git checkout --ours <文件名>",
"例如:",
"3. **保存并提交**:使用 `git add` 和 `git commit` 来保存并提交修改。"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 14,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub TLS 握手失败 — gnutls_handshake() Error (git-tls-handshake-failure)",
"condition": "plain",
"status": 200,
"content": "The error you're experiencing, \"git-tls-handshake-failure,\" typically occurs when there's a problem with the TLS handshake between your Git client and the remote repository. Here's a step-by-step guide to resolve the issue:\n\n**Method 1: Update Git and GnuTLS**\n\n1. **Update Git**: Run the following command to ensure you have the latest version of Git installed.\n\n ```bash\ngit --version\n```\n\n If you're not on the latest version, update Git using the following command.\n\n ```bash\nsudo apt update && sudo apt install git -y\n```\n\n (For macOS users, use Homebrew to update Git.)\n\n ```bash\nbrew update && brew upgrade git\n```\n\n2. **Update GnuTLS**: GnuTLS is a dependency for Git. Run the following command to update GnuTLS.\n\n ```bash\nsudo apt update && sudo apt install libgnutls28-dev -y\n```\n\n (For macOS users, use Homebrew to update GnuTLS.)\n\n ```bash\nbrew update && brew install gnustl\n```\n\n**Method 2: Remove and Reinstall Git**\n\n1. **Remove Git**: Run the following command to remove Git",
"metrics": {
"length": 1017,
"commands": 5,
"command_list": [
"git --version",
"sudo apt update && sudo apt install git -y",
"brew update && brew upgrade git",
"sudo apt update && sudo apt install libgnutls28-dev -y",
"brew update && brew install gnustl"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub TLS 握手失败 — gnutls_handshake() Error (git-tls-handshake-failure)",
"condition": "with_lesson",
"status": 200,
"content": "解决 GitHub TLS 握手失败 — gnutls_handshake() Error 的方法如下:\n\n### 步骤 1:重试(排除瞬时抖动)\n\n```bash\ngit pull origin main\n```\n\n### 步骤 2:检查并配置代理\n\n#### 1.查看当前 git 代理设置\n\n```bash\ngit config --global --list | grep proxy\n```\n\n#### 2.配置 git 走代理(如果使用代理)\n\n```bash\ngit config --global http.proxy http://127.0.0.1:7890\ngit config --global https.proxy http://127.0.0.1:7890\n```\n\n#### 3.清除错误的代理配置(如果不需要代理)\n\n```bash\ngit config --global --unset http.proxy\ngit config --global --unset https.proxy\n```\n\n### 步骤 3:更新 CA 证书\n\n#### 1. Debian / Ubuntu\n\n```bash\nsudo apt update && sudo apt install --reinstall ca-certificates\n```\n\n#### 2. RHEL / CentOS / Fedora\n\n```bash\nsudo update-ca-trust\n```\n\n### 步骤 4:切换",
"metrics": {
"length": 666,
"commands": 8,
"command_list": [
"git pull origin main",
"git config --global --list | grep proxy",
"git config --global http.proxy http://127.0.0.1:7890",
"git config --global https.proxy http://127.0.0.1:7890",
"git config --global --unset http.proxy"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 11,
"lesson_hits": 2,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitGuardian 误报 Basic Auth String:教程里凭证占位符必须用尖括号,不写完整 user:pass@host (gitguardian-placeholder-url-credential-safe-form)",
"condition": "plain",
"status": 200,
"content": "The error message is indicating that the placeholder for the Basic Auth credentials in your GitGuardian configuration is not properly formatted. The fix is to replace the placeholder with the correct syntax, which includes the `@` symbol.\n\nHere's a step-by-step guide to resolve the issue:\n\n1. Open your GitGuardian configuration file in a text editor. The file name may vary depending on your setup, but it's usually `gitguardian.yml` or `gitguardian.json`.\n\n2. Locate the section related to Basic Auth credentials. It should look something like this:\n\n```yml\nbasic_auth:\n username: user\n password: pass\n host: host\n```\n\n3. Replace the placeholder with the correct syntax:\n\n```yml\nbasic_auth:\n username: user\n password: pass\n host: user:pass@host\n```\n\nOr, if you prefer to use the credential-safe-form:\n\n```yml\nbasic_auth:\n username: user\n password: pass\n host: gitguardian-placeholder-url-credential-safe-form\n```\n\n4. Save the changes to the configuration file.\n\nAfter making these changes, GitGuardian should be able to properly parse the Basic Auth credentials from your configuration file.\n\nIf you",
"metrics": {
"length": 1111,
"commands": 2,
"command_list": [
"3. Replace the placeholder with the correct syntax:",
"Or, if you prefer to use the credential-safe-form:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitGuardian 误报 Basic Auth String:教程里凭证占位符必须用尖括号,不写完整 user:pass@host (gitguardian-placeholder-url-credential-safe-form)",
"condition": "with_lesson",
"status": 200,
"content": "To fix this issue, you'll need to update your GitGuardian configuration and lessons.json files. Here are the steps:\n\n**Step 1: Update lessons.json**\n\nOpen your lessons.json file and search for the `preview` field. Replace any occurrences of the following pattern:\n\n```json\n\"preview\": \"git push https://username:TOKEN@github.com/owner/repo.git\"\n```\n\nwith the following pattern:\n\n```json\n\"preview\": \"git push https://\npassword: bin/downloads/large-file\n\n# 生成 .version 标记文件\necho $(date +%Y-%m-%d-%H-%M-%S) > .version\n\n# 分段下载\nfor i in {0..5}; do\n start=$((i * 10485760))\n end=$(( (i + 1) * 10485760 - 1 ))\n curl -C - -R -o \"segment_$i\" \\\n \"https://ghproxy.net/https://github.com/owner/repo/releases/download/v1.0/large-file\" \\\n -H \"Range: bytes=$start-$end\" \\\n --retry 3 --retry-delay 5 &\ndone\n\n# 等待所有下载完成\nwait\n\n# 合并分段\ncat bin/downloads/segment_*. > bin/downloads/large-file\n\n# 校验\nsha256sum -c",
"metrics": {
"length": 668,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub Release 大文件下载在 CN 网络超时:分段并行下载方案 (github-release-large-asset-download-cn)",
"condition": "plain",
"status": 200,
"content": "The error message you're encountering is due to the GitHub release large asset download being timed out when downloading on Chinese networks. Here's a concrete, actionable fix:\n\n**Solution:**\n\n1. **Use a VPN:** Install a VPN (Virtual Private Network) on your device. A VPN will mask your IP address and make it appear as if you're accessing the internet from a different location. This can help bypass the network restrictions imposed by your ISP (Internet Service Provider) on Chinese networks.\n\n * For Windows: Download and install TunnelBear VPN. Create an account, then install the app and set it to connect automatically when you start your computer.\n * For macOS: Download and install ExpressVPN. Create an account, then install the app and set it to connect automatically when you start your computer.\n * For Linux: Download and install NordVPN. Create an account, then install the app and set it to connect automatically when you start your computer.\n\n2. **Use a proxy server:** Another alternative is to use a proxy server to bypass the network restrictions imposed by your ISP on Chinese networks.\n\n * For Windows: Download and install the \"Free Proxy\" software. Create an account, then install the software and set it to connect automatically",
"metrics": {
"length": 1275,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub sudo email OTP fails when the wrong input is filled (github-sudo-email-otp-wrong-input-field)",
"condition": "plain",
"status": 200,
"content": "The error you're experiencing is likely due to the incorrect input in the GitHub sudo email OTP field. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Clear the OTP field**\n\nRun the following command in your terminal:\n```bash\necho -e \"\\033[2J\\033[H\" # Clear the terminal screen\n```\nThis will clear the OTP field.\n\n**Step 2: Re-enter the OTP**\n\nEnter the correct OTP code when prompted.\n\n**Step 3: Verify the OTP**\n\nIf you're still having trouble, you can try re-entering the OTP manually:\n```bash\ngit config --global user.password \n```\nReplace `` with your actual GitHub username.\n\n**Step 4: Add the OTP to the Git config**\n\nRun the following command to add the OTP to the Git config:\n```bash\ngit config --global user.password \"\"\n```\nReplace `` with the correct OTP code.\n\n**Step 5: Update the Git config**\n\nRun the following command to update the Git config:\n```bash\ngit config --global --list\n```\nThis will display the updated Git config.\n\n**Troubleshooting**\n\nIf you",
"metrics": {
"length": 1043,
"commands": 4,
"command_list": [
"echo -e \"\\033[2J\\033[H\" # Clear the terminal screen",
"git config --global user.password ",
"git config --global user.password \"\"",
"git config --global --list"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub sudo email OTP fails when the wrong input is filled (github-sudo-email-otp-wrong-input-field)",
"condition": "with_lesson",
"status": 200,
"content": "The issue you're facing is due to the hidden input fields on the GitHub sudo email verification page. To fix this, you need to target the hidden input fields specifically. Here's a concrete, actionable fix with exact commands using Playwright:\n\n```javascript\nconst playwright = require('playwright');\n\n(async () => {\n const browser = await playwright.chromium.launch();\n const page = await browser.newPage();\n\n // Navigate to the GitHub sudo email verification page\n await page.goto('https://github.com/login');\n\n // Click Verify via email\n await page.click('text=Verify via email');\n\n // Wait for the OTP code to be displayed\n await page.waitForSelector('#email-otp');\n\n // Get the OTP code from Gmail\n const otpCode = await page.$eval('#email-otp', (el) => el.textContent());\n\n // Fill the hidden input fields for CSRF and credential type\n await page.fill('#sudo-credential-options-github-mobile-csrf', '');\n await page.fill('#sudo-credential-options-totp-email-csrf', '');\n await page.fill('#authenticity_token', '');\n await page.fill('#sudo_return_to', '');\n await page.fill('#credential_type', '');\n\n // Fill the visible OTP",
"metrics": {
"length": 1146,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Glama MCP Server Deployment — 10 Build Failures and Fixes (glama-mcp-server-deploy-lessons)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the 10 build failures and fixes, you can follow these concrete, actionable steps:\n\n**Step 1: Use uv pip install instead of pip install**\n\n Replace `pip install` with `uv pip install` in your `setup.py` file.\n\n```python\n# Before\npip install -r requirements.txt\n\n# After\nuv pip install -r requirements.txt\n```\n\n**Step 2: Create a virtual environment using uv venv**\n\n Run the following command before installing dependencies:\n\n```bash\nuv venv myenv\n```\n\nThen, activate the virtual environment:\n\n```bash\nuv venv myenv/bin/activate\n```\n\n**Step 3: Don't use --system flag**\n\n Replace `pip install --system` with `pip install` in your `setup.py` file.\n\n```python\n# Before\npip install --system -r requirements.txt\n\n# After\npip install -r requirements.txt\n```\n\n**Step 4: Install the package using uv pip install -e .**\n\n Run the following command in your project directory:\n\n```bash\nuv pip install -e .\n```\n\nThis will install the package and its dependencies.\n\n**Additional Steps**\n\nAfter making these changes, you can re-deploy your Python MCP server to Gl",
"metrics": {
"length": 1056,
"commands": 7,
"command_list": [
"**Step 2: Create a virtual environment using uv venv**",
"Run the following command before installing dependencies:",
"Then, activate the virtual environment:",
"**Step 3: Don't use --system flag**",
"Replace `pip install --system` with `pip install` in your `setup.py` file."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 15,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Go Scheduler Deadlock — Nested Lock Acquisition in gocron v1 (go-scheduler-deadlock-lock-order)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the deadlock issue, we need to ensure that the locks are released in the correct order. Here's the corrected code:\n\n```go\n// Original (fixed) code:\nfunc (s Scheduler) RemoveByID(job Job) error {\n // Release RLock before acquiring LLock\n s.jobsMutex.RUnlock()\n s.jobsMutex.Lock()\n defer s.jobsMutex.Unlock() // Lock held through entire function\n if _, ok := s.jobs[job.id]; ok {\n s.stopJob(job) // no longer holding jobsMutex.Lock!\n delete(s.jobs, job.id)\n return nil\n }\n return ErrJobNotFound\n}\n\nfunc (s Scheduler) runJobs() {\n // Release LLock before acquiring RLock\n s.jobsMutex.Unlock()\n s.jobsMutex.RLock()\n defer s.jobsMutex.RUnlock()\n for _, job := range s.jobs {\n // send job to executor...\n s.runContinuous(job)\n }\n}\n```\n\nIn the `RemoveByID` method, we first release the `RLock` using `s.jobsMutex.RUnlock()` before acquiring the `LLock` using `s.jobsMutex.Lock()`. This ensures that the `RLock` is released before the `LLock",
"metrics": {
"length": 1024,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 8,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Glama MCP Server Deployment — 10 Build Failures and Fixes (glama-mcp-server-deploy-lessons)",
"condition": "plain",
"status": 200,
"content": "The error \"Glama MCP Server Deployment — 10 Build Failures and Fixes\" typically occurs when the deployment of the Glama MCP server fails due to various reasons such as configuration issues, missing dependencies, or incorrect settings. Here's a step-by-step guide to fix this issue:\n\n**Prerequisites:**\n\n* Ensure you have a clean and updated environment.\n* Make sure you have the latest version of the Glama MCP server and its dependencies.\n\n**Step 1: Check the Glama MCP Server Logs**\n\nTo identify the root cause of the issue, check the Glama MCP server logs for any errors or warnings:\n```bash\n# Navigate to the Glama MCP server logs directory\ncd /path/to/glama-mcp-server-logs\n\n# Check the latest log file for errors\ntail -f log.txt\n```\nThis will show you the latest log entries, which can help you identify the issue.\n\n**Step 2: Update the Glama MCP Server**\n\nEnsure you have the latest version of the Glama MCP server installed:\n```bash\n# Update the Glama MCP server package\nsudo apt-get update\nsudo apt-get upgrade -y glama-mcp-server\n```\n**Step 3: Check for Missing Dependencies**\n\nVerify that all required",
"metrics": {
"length": 1112,
"commands": 4,
"command_list": [
"cd /path/to/glama-mcp-server-logs",
"tail -f log.txt",
"sudo apt-get update",
"sudo apt-get upgrade -y glama-mcp-server"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 3,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Go Scheduler Deadlock — Nested Lock Acquisition in gocron v1 (go-scheduler-deadlock-lock-order)",
"condition": "plain",
"status": 200,
"content": "The \"Go Scheduler Deadlock — Nested Lock Acquisition\" error is typically caused by a deadlock situation in the Go scheduler. This error is usually a result of the way the scheduler handles goroutines and locks.\n\nHere's a concrete, actionable fix with exact commands to resolve the issue:\n\n**Step 1: Update gocron to the latest version**\n\nFirst, update gocron to the latest version using the following command:\n\n```bash\ngo get -u github.com/jroimartin/gocron\n```\n\n**Step 2: Update gocron to use the new lock order**\n\nThe new lock order in gocron v1 is designed to prevent deadlocks. To update gocron to use the new lock order, you need to update the `gocron.conf` file. Here's an example of how to do it:\n\n```bash\n# Create a new file called gocron.conf\necho \"schedule: 0 0 * * *\" > gocron.conf\n```\n\nThen, update the `gocron.conf` file to use the new lock order by adding the following lines:\n\n```bash\nlock:\n - main\n - job\n```\n\n**Step 3: Update the cron job to use the",
"metrics": {
"length": 968,
"commands": 5,
"command_list": [
"go get -u github.com/jroimartin/gocron",
"echo \"schedule: 0 0 * * *\" > gocron.conf",
"lock:",
"- main",
"- job"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub Contribution Heartbeat Scan (heartbeat-scan-improvement)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to modify your GitHub Heartbeat Scan script to include the three required scans: opened PRs, claimed issues, and closed PRs. Here's an example of how you can modify your script:\n\n```bash\n#!/bin/bash\n\n# Set your GitHub username and token\nUSER=\"your-username\"\nTOKEN=\"your-github-token\"\n\n# Set the date for the closed PR scan (YYYY-MM-DD)\nCLOSED_PR_DATE=\"2023-03-01\"\n\n# Run the three scans\ngh search prs --author=$USER --state=open --limit=30\ngh search issues --involves=$USER --state=open --updated=$CLOSED_PR_DATE --limit=20\ngh search prs --author=$USER --state=closed --sort=updated --limit=10\n```\n\nMake sure to replace `your-username` and `your-github-token` with your actual GitHub username and token.\n\nIf you're using a script, you can also add some error handling to ensure that all three scans are successful:\n\n```bash\n#!/bin/bash\n\n# Set your GitHub username and token\nUSER=\"your-username\"\nTOKEN=\"your-github-token\"\n\n# Set the date for the closed PR scan (YYYY-MM",
"metrics": {
"length": 995,
"commands": 6,
"command_list": [
"USER=\"your-username\"",
"TOKEN=\"your-github-token\"",
"CLOSED_PR_DATE=\"2023-03-01\"",
"gh search prs --author=$USER --state=open --limit=30",
"gh search issues --involves=$USER --state=open --updated=$CLOSED_PR_DATE --limit=20"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 4,
"lesson_hits": 4,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub Contribution Heartbeat Scan (heartbeat-scan-improvement)",
"condition": "plain",
"status": 200,
"content": "To fix the GitHub Contribution Heartbeat Scan error, you'll need to update your `package.json` file to include the required `github-contribution-heartbeat` version. Here's a step-by-step solution:\n\n**Step 1: Install the required package**\n\nOpen your terminal and navigate to your project directory. Run the following command to install the required package:\n\n```bash\nnpm install github-contribution-heartbeat@latest\n```\n\nor if you're using yarn:\n\n```bash\nyarn add github-contribution-heartbeat@latest\n```\n\n**Step 2: Update the `package.json` file**\n\nOpen your `package.json` file in a text editor. Look for the `dependencies` or `devDependencies` section, which should contain the `github-contribution-heartbeat` package. Update the version number to `@latest`, which will install the latest version of the package.\n\nHere's an example of what the updated `package.json` file might look like:\n\n```json\n{\n \"name\": \"your-project-name\",\n \"version\": \"1.0.0\",\n \"description\": \"Your project description\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"start\": \"node index.js\"\n },\n \"",
"metrics": {
"length": 1075,
"commands": 2,
"command_list": [
"npm install github-contribution-heartbeat@latest",
"yarn add github-contribution-heartbeat@latest"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 13,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Hub Hermes 凭证体系 — Gateway vs Hub 各自读哪里 (hub-credential-gateway-vs-hub)",
"condition": "plain",
"status": 200,
"content": "The error message you're encountering is likely due to a configuration issue with the Hub Hermes credential system. The error is suggesting that there's a difference between the gateway and hub credential systems.\n\nTo resolve this issue, you can try the following steps:\n\n1. Check the Hub Hermes configuration:\n - Open a terminal and navigate to the directory where your Hub Hermes configuration file is located.\n - Run the following command to check the configuration:\n ```bash\nhub config\n```\n This will display the current configuration of your Hub Hermes system.\n\n2. Check the credential system configuration:\n - Run the following command to check the credential system configuration:\n ```bash\nhub credential config\n```\n This will display the current configuration of your credential system.\n\n3. Check the gateway and hub configurations:\n - Run the following command to check the gateway configuration:\n ```bash\nhub gateway config\n```\n - Run the following command to check the hub configuration:\n ```bash\nhub hub config\n```\n These commands will display the current configuration of your gateway and hub systems.\n\n4. Update the configuration:\n - If you find any discrepancies between the gateway and hub configurations, you can update the configuration using the following command:\n ```bash\nhub config",
"metrics": {
"length": 1341,
"commands": 4,
"command_list": [
"hub config",
"hub credential config",
"hub gateway config",
"hub hub config"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Hub Hermes 凭证体系 — Gateway vs Hub 各自读哪里 (hub-credential-gateway-vs-hub)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to set the `FEISHU_APP_SECRET` environment variable in the Hub configuration. Here are the steps:\n\n1. Open your terminal and navigate to the directory where your `config.yaml` file is located.\n2. Run the following command to set the `FEISHU_APP_SECRET` environment variable:\n ```bash\nexport FEISHU_APP_SECRET=\n```\n Replace `` with your actual Feishu App Secret.\n\n3. Update the `config.yaml` file by adding the following lines:\n ```yaml\nfeishu:\n app_id: \"\"\n app_secret: \"\"\n webhook_url: \"\"\nmaster:\n shared_secret: \"\"\n```\n Replace the placeholders with your actual Feishu App ID, App Secret, Webhook URL, and Shared Secret.\n\n4. Run the following command to verify that the configuration is correct:\n ```bash\nfeishu:\necho \"Verification passed: fix command exited 0\"\n```\n This command should complete without error, and then print \"Verification passed: fix command exited 0\".\n\nHere's the complete command sequence:\n\n```bash",
"metrics": {
"length": 1050,
"commands": 5,
"command_list": [
"export FEISHU_APP_SECRET=",
"Replace the placeholders with your actual Feishu App ID, App Secret, Webhook URL, and Shared Secret.",
"4. Run the following command to verify that the configuration is correct:",
"This command should complete without error, and then print \"Verification passed: fix command exited 0\".",
"Here's the complete command sequence:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "hub feishu wsclient start never called (hub-feishu-wsclient-start-never-called)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"hub feishu wsclient start never called (hub-feishu-wsclient-start-never-called)\", you need to add the following line of code to your `hermes_hub.py` file in the `start()` method:\n\n```python\nawait self.feishu_ws_client.start()\n```\n\nHere's how you can do it:\n\n1. Open your `hermes_hub.py` file in a text editor.\n2. Locate the `start()` method.\n3. Add the following line of code after `await self._register_handlers()`:\n\n```python\nawait self.feishu_ws_client.start()\n```\n\nHere's what the updated `start()` method should look like:\n\n```python\nasync def start(self):\n await self._load_config()\n await self._init_storage()\n await self._init_feishu_client()\n await self._init_vector_store()\n await self.feishu_ws_client.start()\n await self._register_handlers()\n self._start_background_tasks()\n```\n\nAfter making this change, save the file and run your hub again. The error should be resolved, and your hub should now establish a WebSocket connection with Feishu.",
"metrics": {
"length": 993,
"commands": 5,
"command_list": [
"Here's how you can do it:",
"1. Open your `hermes_hub.py` file in a text editor.",
"2. Locate the `start()` method.",
"3. Add the following line of code after `await self._register_handlers()`:",
"Here's what the updated `start()` method should look like:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "hub feishu wsclient start never called (hub-feishu-wsclient-start-never-called)",
"condition": "plain",
"status": 200,
"content": "The error \"hub-feishu wsclient start never called\" typically indicates that the Feishu Websocket Client is not being started. This can be due to various reasons such as the client not being installed, or the client not being configured correctly.\n\nTo fix this issue, you can try the following steps:\n\n1. **Check if the Feishu Websocket Client is installed:**\n\n Run the following command to check if the Feishu Websocket Client is installed:\n ```bash\npip show hub-feishu-wsclient\n```\n If the client is not installed, run the following command to install it:\n ```bash\npip install hub-feishu-wsclient\n```\n\n2. **Check the configuration file:**\n\n The Feishu Websocket Client uses a configuration file to store its settings. The default configuration file is `~/.feishu/config.json`. Check if the configuration file is present and if it contains the required settings.\n\n If the configuration file is not present, create a new one using the following command:\n ```bash\nhub-feishu config create\n```\n Then, edit the configuration file using the following command:\n ```bash\nhub-feishu config edit\n```\n\n",
"metrics": {
"length": 1110,
"commands": 4,
"command_list": [
"pip show hub-feishu-wsclient",
"pip install hub-feishu-wsclient",
"hub-feishu config create",
"hub-feishu config edit"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Auto-Welcome Newcomers via issue_comment Event (issue-comment-newbie-welcome)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to update the GitHub Actions workflow file (e.g., `.yml` file) to use the `github-script` action with the correct script and permissions.\n\nHere's the updated code:\n\n```yml\nname: Newbie Welcome\non:\n issue_comment:\n types: [created]\n\npermissions:\n issues: write\n pull-requests: read\n\njobs:\n welcome:\n if: |\n !github.event.issue.pull_request &&\n contains(github.event.issue.labels..name, 'good first issue') &&\n !contains(fromJSON('[\"MEMBER\", \"OWNER\", \"COLLABORATOR\"]'), github.event.comment.author_association)\n runs-on: ubuntu-latest\n steps:\n - name: Welcome Newcomer\n uses: actions/github-script@v7\n with:\n script: |\n const body = 'Welcome to MisakaNet!';\n\n You're commenting on a Good First Issue.\n\n 1. Read the CONTRIBUTING.md guide\n 2. Claim by commenting \\/claim\\ — 8h exclusive window\n 3. Implement with \\git commit -s\\\n 4. Submit a PR — CI audits automatically;\n\n await github",
"metrics": {
"length": 1045,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Auto-Welcome Newcomers via issue_comment Event (issue-comment-newbie-welcome)",
"condition": "plain",
"status": 200,
"content": "To fix the error \"Auto-Welcome Newcomers via issue_comment Event (issue-comment-newbie-welcome)\", you'll need to create a new event listener that listens for the `issue_comment` event and sends a welcome message to the new user. Here's a step-by-step guide:\n\n**Step 1: Create a new event listener**\n\nIn your repository's `.gitignore` file, add the following line to ignore the `issue_comment_newbie_welcome` event listener:\n```bash\nissue-comment-newbie-welcome\n```\n**Step 2: Create a new event listener file**\n\nRun the following command to create a new file for the event listener:\n```bash\nmkdir issue-comment-newbie-welcome\ntouch issue-comment-newbie-welcome.js\n```\n**Step 3: Add the event listener code**\n\nIn the `issue-comment-newbie-welcome.js` file, add the following code:\n```javascript\nconst { Octokit } = require('@octokit/octokit');\n\nconst octokit = new Octokit({\n baseUrl: 'https://api.github.com',\n accessToken: 'YOUR_GITHUB_TOKEN',\n});\n\nasync function welcomeNewcomer(comment) {\n const issue = await octokit.issues.getAll({ owner: 'YOUR_RE",
"metrics": {
"length": 1054,
"commands": 3,
"command_list": [
"issue-comment-newbie-welcome",
"mkdir issue-comment-newbie-welcome",
"touch issue-comment-newbie-welcome.js"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "同义词扩展陷阱:jieba.add_word() 改变全局分词行为导致回归 (jieba-synonym-expansion-pitfall)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to the fact that `jieba.add_word()` modifies the global tokenizer behavior, which can lead to unexpected results. Here's a concrete, actionable fix:\n\n**Solution:**\n\nInstead of using `jieba.add_word()`, use `jieba.add_symbol()` to add custom symbols to your vocabulary.\n\n```python\nimport jieba\n\n# Create a new tokenizer\ntokenizer = jieba.Jieba()\n\n# Add custom symbols to the tokenizer\ntokenizer.add_symbol('custom_symbol')\n\n# Use the tokenizer to perform tokenization\ntext = \"This is a custom symbol test\"\ntokens = tokenizer.cut(text)\n\nprint(tokens)\n```\n\n**Explanation:**\n\n* We create a new tokenizer instance using `jieba.Jieba()`.\n* We add a custom symbol to the tokenizer using `tokenizer.add_symbol('custom_symbol')`.\n* We use the tokenizer to perform tokenization on a sample text.\n* The resulting tokens are printed to the console.\n\n**Note:** If you want to add multiple custom symbols, you can call `add_symbol()` multiple times.\n\n```python\ntokenizer.add_symbol('custom_symbol1')\ntokenizer.add_symbol('custom_symbol2')\n```\n\nBy using `add_symbol()` instead of `add_word",
"metrics": {
"length": 1119,
"commands": 6,
"command_list": [
"**Explanation:**",
"* We create a new tokenizer instance using `jieba.Jieba()`.",
"* We add a custom symbol to the tokenizer using `tokenizer.add_symbol('custom_symbol')`.",
"* We use the tokenizer to perform tokenization on a sample text.",
"* The resulting tokens are printed to the console."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "同义词扩展陷阱:jieba.add_word() 改变全局分词行为导致回归 (jieba-synonym-expansion-pitfall)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the issue, you can create a separate JSON file to store the synonyms and use it to expand the queries. Here's how you can do it:\n\nFirst, create a new file called `synonyms.json` in the same directory as your Python script:\n\n```json\n{\n \"手机\": [\"电话\", \"移动设备\", \"智能手机\"],\n \"电脑\": [\"计算机\", \"PC\", \"笔记本\"]\n}\n```\n\nNext, modify your Python script to use the `synonyms.json` file:\n\n```python\nimport json\nfrom jieba import Jieba\n\n# Load synonyms from JSON file\nwith open('synonyms.json', 'r', encoding='utf-8') as f:\n synonyms = json.load(f)\n\n# Initialize Jieba\njieba = Jieba()\n\ndef expand_query_with_synonyms(query, synonyms):\n expanded = [query]\n for word, syns in synonyms.items():\n if word in query:\n expanded.extend(syns)\n return expanded\n\ndef main():\n query = input(\"Enter a query: \")\n expanded_query = expand_query_with_synonyms(query, synonyms)\n print(\"Expanded query:\", expanded_query)\n\nif __name__ == \"__main__\":\n main",
"metrics": {
"length": 962,
"commands": 1,
"command_list": [
"Next, modify your Python script to use the `synonyms.json` file:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 4,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "JSON 解析失败Handling — 截断 / 格式Error (json-parse-failure-handling)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the `JSON 解析失败Handling — 截断 / 格式Error` issue, you can try the following steps:\n\n### Step 1: Update the `model_output` variable\n\nMake sure the `model_output` variable contains the complete and formatted JSON data. If the output is truncated, you can try to get the full output from the model or API.\n\n```bash\n# Get the full output from the model or API\nmodel_output=$(model_output)\n```\n\n### Step 2: Use the `safe_json_parse` function\n\nReplace the original code with the `safe_json_parse` function:\n\n```python\nimport json\nimport re\n\ndef safe_json_parse(text: str) -> dict | None:\n \"\"\"尝试多种策略解析 JSON\"\"\"\n \n try:\n return json.loads(text)\n except json.JSONDecodeError:\n pass\n \n m = re.search(r'(?:json)?\\s\\n?(.?)\\n?', text, re.DOTALL)\n if m:\n try:\n return json.loads(m.group(1))\n except json.JSONDecodeError:\n pass\n \n m = re.search(r'(\\{.\\})', text, re.DOTALL)\n if m:\n ",
"metrics": {
"length": 955,
"commands": 1,
"command_list": [
"model_output=$(model_output)"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "JSON 解析失败Handling — 截断 / 格式Error (json-parse-failure-handling)",
"condition": "plain",
"status": 200,
"content": "The error message \"JSON 解析失败Handling — 截断 / 格式Error (json-parse-failure-handling)\" is a translation of \"JSON parsing failed - Handling: Cutting / Format Error\" in English. This error typically occurs when there's an issue with the JSON data being parsed, such as a missing closing bracket or a mismatched quote.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Method 1: Using `jq` command**\n\nIf you're using a Linux or macOS system, you can use the `jq` command to parse and fix the JSON data.\n\n1. Install `jq` if you haven't already: `sudo apt-get install jq` (for Ubuntu-based systems) or `brew install jq` (for macOS).\n2. Use `jq` to parse the JSON data and fix the errors:\n\n```bash\njq '.' your_json_file.json\n```\n\nThis command will print the parsed JSON data with any errors fixed.\n\n**Method 2: Using `jsonlint` command**\n\nAlternatively, you can use the `jsonlint` command to validate and fix the JSON data.\n\n1. Install `jsonlint` if you haven't already: `sudo apt-get install jsonlint` (for Ubuntu-based systems) or `",
"metrics": {
"length": 1033,
"commands": 1,
"command_list": [
"jq '.' your_json_file.json"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 12,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Knowledge Base 4-Sigma Quality Audit Pipeline (kb-4sigma-quality-audit-pipeline)",
"condition": "with_lesson",
"status": 200,
"content": "To implement the 4σ quality audit pipeline, we'll use Python with the following libraries:\n\n- `pandas` for data manipulation\n- `os` for file system operations\n- `datetime` for timestamping\n- `json` for storing reports\n\nHere's a step-by-step guide to fix the issue:\n\n**Step 1: Install required libraries**\n\n```bash\npip install pandas os datetime json\n```\n\n**Step 2: Create a directory for audit reports**\n\n```bash\nmkdir ~/audit_reports\n```\n\n**Step 3: Create a Python script (daily_audit.py) for the quality audit pipeline**\n\n```python\nimport os\nimport pandas as pd\nimport datetime\nimport json\n\n# Define constants\nAUDIT_DIR = \"~/audit_reports\"\nREPORT_NAME = \"audit_\"\nCSV_FILE = \"daily_audit.csv\"\n\n# Function to clean up non-document content\ndef clean_document(content):\n # Remove garbled text, empty chunks, and numeric-only chunks\n content = content.replace(\"\\n\", \" \")\n content = content.replace(\"\\t\", \" \")\n content = content.replace(\" \", \"\")\n return content\n\n# Function to deduplicate documents by filename and import time\ndef deduplicate_documents(df):\n # Group by filename",
"metrics": {
"length": 1092,
"commands": 2,
"command_list": [
"pip install pandas os datetime json",
"mkdir ~/audit_reports"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Knowledge Base 4-Sigma Quality Audit Pipeline (kb-4sigma-quality-audit-pipeline)",
"condition": "plain",
"status": 200,
"content": "To fix the error, we'll assume that the error is related to a missing or incorrect configuration file for the Knowledge Base 4-Sigma Quality Audit Pipeline. Here's a step-by-step guide with exact commands to resolve the issue:\n\n**Step 1: Check the Pipeline Configuration**\n\n1. Navigate to the pipeline directory: `cd /path/to/kb-4sigma-quality-audit-pipeline`\n2. Run the following command to check the pipeline configuration: `kubectl get deployments -n -l app=kb-4sigma-quality-audit-pipeline`\n\nReplace `` with the actual namespace where your pipeline is running.\n\n**Step 2: Check for Missing Configuration Files**\n\n1. Run the following command to check for missing configuration files: `kubectl get configmaps -n -l app=kb-4sigma-quality-audit-pipeline`\n\nReplace `` with the actual namespace where your pipeline is running.\n\nIf you find any missing configuration files, you can create them using the following commands:\n\n```bash\nkubectl create configmap kb-4sigma-quality-audit-pipeline-config --from-file=KB4SIGMA Quality Audit Pipeline Configuration=kb-4sigma-quality-audit-pipeline.yaml\nkubectl create configmap kb-",
"metrics": {
"length": 1166,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "knowledge graph ux patterns from high star projects (knowledge-graph-ux-patterns-from-high-star-projects)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to make sure that your knowledge graph visualization is properly handling the balance between global overview and local details. Here are some concrete, actionable steps with exact commands to help you achieve this:\n\n**Step 1: Implement Progressive Disclosure**\n\nAdd the following code to your JavaScript file to implement progressive disclosure:\n\n```javascript\n// Define a function to get the neighbors of a node\nfunction getNHopNeighbors(nodeId, hops, edges) {\n const visited = new Set([nodeId]);\n let frontier = [nodeId];\n for (let i = 0; i < hops; i++) {\n const next = new Set();\n frontier.forEach(id => {\n edges.forEach(edge => {\n const sid = edge.source?.id || edge.source;\n const tid = edge.target?.id || edge.target;\n if (sid === id && !visited.has(tid)) next.add(tid);\n if (tid === id && !visited.has(sid)) next.add(sid);\n });\n });\n frontier = [...next];\n }\n return visited;\n}\n\n// Define a function to get the category of a node\nfunction getCategory(node) {\n // Implement your logic to get the category of a node\n // For example, you can",
"metrics": {
"length": 1130,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "knowledge graph ux patterns from high star projects (knowledge-graph-ux-patterns-from-high-star-projects)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to a missing `requirements.txt` file or a version mismatch in your `setup.py` file. Here's a step-by-step guide to fixing the issue:\n\n**Step 1: Create a `requirements.txt` file**\n\nOpen a terminal and navigate to your project directory. Run the following command to generate a `requirements.txt` file:\n```bash\npip freeze > requirements.txt\n```\nThis command will list all the packages installed in your Python environment, including their versions.\n\n**Step 2: Update `setup.py`**\n\nIf your `setup.py` file is not present, create a new one with the following content:\n```python\nfrom setuptools import setup\n\nsetup(\n name='knowledge-graph-ux-patterns-from-high-star-projects',\n version='0.0.1',\n packages=['knowledge_graph_ux_patterns'],\n install_requires=[\n 'numpy',\n 'pandas',\n 'scikit-learn',\n # Add other dependencies here\n ],\n)\n```\nReplace `numpy`, `pandas`, and `scikit-learn` with the actual dependencies required by your project.\n\n**Step 3: Install dependencies**\n\nRun the following command to install the dependencies listed in `requirements.txt`",
"metrics": {
"length": 1137,
"commands": 1,
"command_list": [
"pip freeze > requirements.txt"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 13,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Tips for Debugging Kubernetes CrashLoopBackOff in a Container (kubernetes-crashloopbackoff-debugging)",
"condition": "with_lesson",
"status": 200,
"content": "To debug a Kubernetes CrashLoopBackOff issue, you need to identify the root cause. Based on the provided lesson, the two common problems when starting a container are:\n\n1. OCI runtime create failed: References a binary or script that doesn't exist on the container (Exit Code 127)\n2. Container \"Completed\" or \"Error\": The code executing on the container failed to run a service and stay running (Exit Code 1)\n\nHere's a concrete, actionable fix with exact commands:\n\n### Step 1: Identify Docker Entrypoint and Cmd\n\nSince you lack the Dockerfile, pull and inspect the image locally:\n\n```bash\n# Pull the Elasticsearch image\ndocker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.2\n\n# Inspect the image and extract the Entrypoint and Cmd\ndocker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Entrypoint'\ndocker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Cmd'\n```\n\n### Step 2: Override Container Entrypoint for Debugging\n\nUpdate the deployment to replace the container entrypoint with `tail -f /dev/null`",
"metrics": {
"length": 1093,
"commands": 3,
"command_list": [
"docker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.2",
"docker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Entrypoint'",
"docker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Cmd'"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Ubuntu WSL Python venv Missing pip — uv venv --seed Fixes Without sudo (lesson-07-uv-venv-seed-fix-no-pip)",
"condition": "with_lesson",
"status": 200,
"content": "The issue you're facing is due to the stripped Python package on Ubuntu WSL, which doesn't include pip by default. To fix this, you can use the following steps:\n\n**Step 1: Install `python3-pip`**\n\nSince `python3-pip` is not installed, you can install it using the following command:\n\n```bash\nsudo apt install python3-pip\n```\n\n**Step 2: Verify the installation**\n\nAfter installation, verify that pip is installed correctly by running:\n\n```bash\npython3 -m pip --version\n```\n\nYou should see the version of pip installed.\n\n**Step 3: Create a new virtual environment**\n\nNow that pip is installed, you can create a new virtual environment using the following command:\n\n```bash\npython3 -m venv ~/.agent-reach-venv\n```\n\n**Step 4: Activate the virtual environment**\n\nTo activate the virtual environment, run:\n\n```bash\nsource ~/.agent-reach-venv/bin/activate\n```\n\nYou should see the virtual environment name printed in your terminal, indicating that it's active.\n\nThat's it! You should now be able to use pip within your virtual environment.\n\nHere are the exact commands you can use:\n\n```bash\n#",
"metrics": {
"length": 1084,
"commands": 4,
"command_list": [
"sudo apt install python3-pip",
"python3 -m pip --version",
"python3 -m venv ~/.agent-reach-venv",
"source ~/.agent-reach-venv/bin/activate"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Tips for Debugging Kubernetes CrashLoopBackOff in a Container (kubernetes-crashloopbackoff-debugging)",
"condition": "plain",
"status": 200,
"content": "The \"CrashLoopBackOff\" error in Kubernetes occurs when a pod is repeatedly restarted due to a container crashing. Here's a concrete, actionable fix to debug and resolve this issue.\n\n**Step 1: Get the pod details**\n\nUse the following command to get the pod details:\n```bash\nkubectl get pod -o yaml\n```\nReplace `` with the actual name of the pod.\n\n**Step 2: Check the container logs**\n\nUse the following command to get the container logs:\n```bash\nkubectl logs -c \n```\nReplace `` with the actual name of the pod and `` with the actual name of the container that's crashing.\n\n**Step 3: Check the container restart policy**\n\nUse the following command to check the container restart policy:\n```bash\nkubectl get pod -o yaml | grep restartPolicy\n```\nThis will show you the restart policy of the pod.\n\n**Step 4: Check the pod's status**\n\nUse the following command to check the pod's status:\n```bash\nkubectl get pod -o yaml\n```\nThis will show you the pod's status, including any error messages",
"metrics": {
"length": 1079,
"commands": 4,
"command_list": [
"kubectl get pod -o yaml",
"kubectl logs -c ",
"kubectl get pod -o yaml | grep restartPolicy",
"kubectl get pod -o yaml"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Ubuntu WSL Python venv Missing pip — uv venv --seed Fixes Without sudo (lesson-07-uv-venv-seed-fix-no-pip)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to the Python version in your WSL (Windows Subsystem for Linux) environment not having a `pip` package. Here's a step-by-step solution to fix the issue:\n\n**Method 1: Update and Install pip using `python` command**\n\n1. Open your WSL terminal.\n2. Update the package list: `sudo apt update`\n3. Install the `python3` package (if not already installed): `sudo apt install python3`\n4. Install `pip` using the `python3` command: `python3 -m ensurepip`\n5. Verify that `pip` has been installed successfully: `pip3 --version`\n\n**Method 2: Install `pip` using `python3 -m venv`**\n\n1. Create a new virtual environment using `python3 -m venv`:\n ```bash\npython3 -m venv myenv\n```\n Replace `myenv` with the name of your choice.\n2. Activate the virtual environment:\n ```bash\nsource myenv/bin/activate\n```\n (On Ubuntu-based WSL, use `source myenv/bin/activate` instead of `myenv\\Scripts\\activate`)\n3. Install `pip",
"metrics": {
"length": 941,
"commands": 2,
"command_list": [
"python3 -m venv myenv",
"source myenv/bin/activate"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 20,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "pip install HTTPS Timeout from WSL — Prepend HTTPS_PROXY=http://172.19.128.1:7890 (lesson-08-pip-https-proxy-clash)",
"condition": "with_lesson",
"status": 200,
"content": "The issue you're facing is due to pip not automatically reading the HTTPS proxy settings, unlike curl. To fix this, you can manually specify the HTTPS proxy in the pip configuration file.\n\nHere are the steps:\n\n1. Open the `~/.pip/pip.conf` file in a text editor:\n ```bash\nnano ~/.pip/pip.conf\n```\n2. Add the following line to the end of the file:\n ```\n[global]\nhttps_proxy = http://172.19.128.1:7890\n```\n Replace `http://172.19.128.1:7890` with your actual proxy URL.\n\n3. Save and close the file.\n\n4. Update pip to read the new configuration:\n ```bash\npip install --upgrade pip\n```\n\n5. Verify that pip is now using the proxy by trying to install the package again:\n ```bash\npip install https://github.com/Panniantong/agent-reach/archive/main.zip\n```\n\nThis should resolve the timeout issue and allow pip to install the package successfully.",
"metrics": {
"length": 849,
"commands": 5,
"command_list": [
"nano ~/.pip/pip.conf",
"[global]",
"https_proxy = http://172.19.128.1:7890",
"pip install --upgrade pip",
"pip install https://github.com/Panniantong/agent-reach/archive/main.zip"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "pip install HTTPS Timeout from WSL — Prepend HTTPS_PROXY=http://172.19.128.1:7890 (lesson-08-pip-https-proxy-clash)",
"condition": "plain",
"status": 200,
"content": "To resolve the HTTPS timeout issue when installing packages using pip with an HTTPS proxy, you can use the following command:\n\n```bash\npip install --proxy http://172.19.128.1:7890 package_name\n```\n\nHowever, if you're using a virtual environment, make sure to activate it before running the command. \n\nHere's an example with a virtual environment:\n\n```bash\n# Activate the virtual environment\nsource myenv/bin/activate\n\n# Install the package with the HTTPS proxy\npip install --proxy http://172.19.128.1:7890 package_name\n```\n\nIf you're using a Windows Subsystem for Linux (WSL), you might need to use the following command instead:\n\n```bash\n# Activate the virtual environment\nsource myenv/bin/activate\n\n# Install the package with the HTTPS proxy\npip install --proxy http://172.19.128.1:7890 package_name\n```\n\nMake sure to replace `myenv` with the name of your virtual environment and `package_name` with the name of the package you're trying to install.\n\nAlso, note that you should use `http://` instead of `https://` in the proxy URL, as HTTPS is not supported in WSL.\n\n",
"metrics": {
"length": 1069,
"commands": 5,
"command_list": [
"pip install --proxy http://172.19.128.1:7890 package_name",
"source myenv/bin/activate",
"pip install --proxy http://172.19.128.1:7890 package_name",
"source myenv/bin/activate",
"pip install --proxy http://172.19.128.1:7890 package_name"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "V2EX API /api/topics/show.json Unstable — Use r.jina.ai Instead (lesson-09-v2ex-api-show-endpoint-unstable)",
"condition": "with_lesson",
"status": 200,
"content": "The error message is indicating that the `/api/topics/show.json` endpoint is unstable and should be replaced with `r.jina.ai`. However, it seems like you're trying to scrape V2EX topic details programmatically. Here's a concrete, actionable fix with exact commands to scrape topic details using `r.jina.ai`:\n\n**Step 1: Install required libraries**\n\n```bash\npip install jina\n```\n\n**Step 2: Create a new Python script**\n\nCreate a new Python file (e.g., `v2ex_scrape.py`) and add the following code:\n\n```python\nimport requests\nfrom jina import Client\n\n# Set API endpoint and credentials\nurl = \"https://r.jina.ai\"\nusername = \"your_username\"\npassword = \"your_password\"\n\n# Create a Jina client\nclient = Client()\n\n# Set the topic ID\ntopic_id = \"1224558\"\n\n# Get the session cookie\nsession = requests.Session()\nresponse = session.get(url, auth=(username, password))\nsession_cookie = response.cookies.get('JSESSIONID')\n\n# Set the headers\nheaders = {\n 'Cookie': f'JSESSIONID={session_cookie}',\n 'Accept': 'application/json'\n}\n\n# Get the topic details\n",
"metrics": {
"length": 1046,
"commands": 1,
"command_list": [
"pip install jina"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub Commit Signing — GPG 防止提交伪造 (lesson-11-github-commit-signing)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the GitHub Commit Signing issue, you need to set up GPG signing for your Git commits. Here's a step-by-step guide with exact commands:\n\n**Step 1: Generate a new GPG key pair**\n\nOpen a terminal and run the following command to generate a new GPG key pair:\n```bash\ngpg --full-generate-key\n```\nThis will create a new GPG key pair in the default location (`~/.gnupg/`).\n\n**Step 2: Get your GPG key ID**\n\nRun the following command to get your GPG key ID:\n```bash\ngpg --list-secret-keys --keyid-format=long\n```\nThis will display your GPG key ID, which should be in the format `ed25519/XXXXXXXXXXXXXXXX`.\n\n**Step 3: Export your GPG public key**\n\nRun the following command to export your GPG public key:\n```bash\ngpg --armor --export XXXXXXXXXXXXXXXX\n```\nReplace `XXXXXXXXXXXXXXXX` with your actual GPG public key ID.\n\n**Step 4: Add your GPG public key to GitHub**\n\nLog in to your GitHub account and go to **Settings** > **SSH and GPG keys**. Click **New SSH key",
"metrics": {
"length": 960,
"commands": 3,
"command_list": [
"gpg --full-generate-key",
"gpg --list-secret-keys --keyid-format=long",
"gpg --armor --export XXXXXXXXXXXXXXXX"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "V2EX API /api/topics/show.json Unstable — Use r.jina.ai Instead (lesson-09-v2ex-api-show-endpoint-unstable)",
"condition": "plain",
"status": 200,
"content": "The error message is indicating that the `/api/topics/show.json` endpoint in the V2EX API is unstable and should be replaced with `r.jina.ai`. This is likely due to changes in the V2EX API.\n\nHere's a concrete and actionable fix:\n\n**Step 1: Update your code**\n\nReplace the line of code that makes the GET request to the `/api/topics/show.json` endpoint with the following:\n```python\nimport requests\n\nresponse = requests.get('https://r.jina.ai/api/topics/show.json')\n```\nOr, if you're using a library like `aiohttp`:\n```python\nimport aiohttp\n\nasync def get_topic():\n async with aiohttp.ClientSession() as session:\n async with session.get('https://r.jina.ai/api/topics/show.json') as response:\n return await response.json()\n```\n\n**Step 2: Update your API client (if applicable)**\n\nIf you're using a library like `requests` or `aiohttp` to interact with the V2EX API, you may need to update the API client to point to the new endpoint.\n\nFor example, with `requests`, you can update the `url` parameter in the `requests.get()` method:\n```python\n",
"metrics": {
"length": 1061,
"commands": 4,
"command_list": [
"Or, if you're using a library like `aiohttp`:",
"**Step 2: Update your API client (if applicable)**",
"If you're using a library like `requests` or `aiohttp` to interact with the V2EX API, you may need to update the API client to point to the new endpoint.",
"For example, with `requests`, you can update the `url` parameter in the `requests.get()` method:"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 12,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "GitHub Commit Signing — GPG 防止提交伪造 (lesson-11-github-commit-signing)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to a missing or invalid GPG key. To fix this, follow these steps:\n\n**Step 1: Generate a new GPG key**\n\nIf you haven't already, generate a new GPG key pair using the following command:\n\n```bash\ngpg --full-generate-key\n```\n\nFollow the prompts to create a new key pair. You'll be asked to choose a key type (e.g., RSA or elliptic curve). Choose one of the options, and then confirm your decision.\n\n**Step 2: Add the new GPG key to your GitHub settings**\n\nOnce you have your new GPG key pair, add it to your GitHub settings. To do this, follow these steps:\n\n1. Log in to your GitHub account and navigate to your profile page.\n2. Click on the \"Settings\" icon (gear icon) and select \"GitHub Settings\" from the dropdown menu.\n3. Scroll down to the \"Account\" section and click on \"SSH and GPG keys\".\n4. Click on the \"New SSH key\" button.\n5. Give your new key a name (e.g., \"My GPG Key\") and paste the contents of your public GPG key (you can find this in the",
"metrics": {
"length": 994,
"commands": 1,
"command_list": [
"gpg --full-generate-key"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 1,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "API 分页设计 — Cursor vs Offset vs Keyset (lesson-14-api-pagination-design)",
"condition": "plain",
"status": 200,
"content": "I don't see any error in your prompt. However, I'll provide a general solution for API pagination design using cursor, offset, and keyset.\n\nLet's assume you're using Node.js and Express.js to create an API. We'll create a simple example of a user endpoint with pagination using cursor, offset, and keyset.\n\n**Database Setup**\n\nWe'll use a simple in-memory database to store our users. In a real-world scenario, you'd use a database like MongoDB or PostgreSQL.\n\n```javascript\n// users.js\nconst users = [\n { id: 1, name: 'John Doe' },\n { id: 2, name: 'Jane Doe' },\n { id: 3, name: 'Bob Smith' },\n { id: 4, name: 'Alice Johnson' },\n { id: 5, name: 'Mike Brown' },\n];\n\nmodule.exports = users;\n```\n\n**API Endpoint with Cursor**\n\nTo implement cursor-based pagination, we need to store the cursor (or token) in our database.\n\n```javascript\n// users.controller.js\nconst express = require('express');\nconst router = express.Router();\nconst users = require('./users');\n\nrouter.get('/users', async (req, res) =>",
"metrics": {
"length": 1005,
"commands": 2,
"command_list": [
"**API Endpoint with Cursor**",
"To implement cursor-based pagination, we need to store the cursor (or token) in our database."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "API 分页设计 — Cursor vs Offset vs Keyset (lesson-14-api-pagination-design)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the issue with the API pagination design, we need to use the Cursor approach. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the database schema**\n\nAdd a new column `cursor_id` to the `posts` table:\n```sql\nALTER TABLE posts ADD COLUMN cursor_id VARCHAR(255) DEFAULT '';\n```\n**Step 2: Update the API endpoint**\n\nUpdate the API endpoint to accept a `cursor` parameter:\n```bash\nGET /api/posts?cursor=\n```\n**Step 3: Update the database query**\n\nUpdate the database query to use the `cursor_id` column:\n```sql\nSELECT FROM posts \nWHERE (created_at, id) < (%s, %s)\nORDER BY created_at DESC, id DESC\nLIMIT %s\n```\n**Step 4: Update the API function**\n\nUpdate the API function to use the `cursor_id` column:\n```python\ndef get_posts(cursor=None, limit=20):\n if cursor:\n query = \"\"\"\n SELECT FROM posts \n WHERE (created_at, id) < (%s, %s)\n ORDER BY created_at DESC, id DESC\n LIMIT %s\n \"\"\"\n results = db.execute(query, [",
"metrics": {
"length": 1008,
"commands": 6,
"command_list": [
"**Step 2: Update the API endpoint**",
"Update the API endpoint to accept a `cursor` parameter:",
"**Step 3: Update the database query**",
"Update the database query to use the `cursor_id` column:",
"**Step 4: Update the API function**"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cloudflare Workflows — 持久化多步骤执行 (lesson-15-cloudflare-workflows-durable)",
"condition": "with_lesson",
"status": 200,
"content": "The error you're encountering is likely due to the missing import statement for the `step` object in your Cloudflare Workflow code. Here's a concrete, actionable fix:\n\n**Step 1: Install required dependencies**\n\nRun the following command in your terminal:\n```bash\nnpm install @cloudflare/workflows\n```\nThis will install the `@cloudflare/workflows` package, which provides the `step` object and other necessary functionality for Cloudflare Workflows.\n\n**Step 2: Update your code**\n\nReplace the contents of your `run.js` file with the following code:\n```javascript\nconst { Step } = require('@cloudflare/workflows');\n\n// Define the persistent workflow\nexport default {\n async run(event, step) {\n // Step 1: Persistent execution (auto-retry, state persistence)\n const userData = await step.do(\"fetch-user\", async () => {\n return await fetch(`https://api.example.com/users/${event.userId}`);\n });\n\n // Step 2: Process data\n const processed = await step.do(\"process-data\", async () => {\n return await processData(userData);\n });\n\n // Step 3: Save result\n await step.do(\"save-result\", async () => {\n await saveToDatabase",
"metrics": {
"length": 1152,
"commands": 1,
"command_list": [
"npm install @cloudflare/workflows"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cloudflare Workflows — 持久化多步骤执行 (lesson-15-cloudflare-workflows-durable)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to a missing or invalid `id` property in your Cloudflare Workflow. Here's a step-by-step solution to fix the issue:\n\n**Step 1: Check your Workflow configuration**\n\nOpen your Cloudflare Workflow in the Cloudflare dashboard. Make sure that you have a valid `id` property in the `workflow` object.\n\n```json\n{\n \"id\": \"your-workflow-id\",\n \"name\": \"your-workflow-name\",\n \"type\": \"durable\",\n \"steps\": [\n // your steps here\n ]\n}\n```\n\n**Step 2: Update your Workflow configuration**\n\nIf you don't have an `id` property, add it to your Workflow configuration. Here's an example:\n```json\n{\n \"id\": \"your-workflow-id\",\n \"name\": \"your-workflow-name\",\n \"type\": \"durable\",\n \"steps\": [\n {\n \"id\": \"step-1\",\n \"name\": \"step-1\",\n \"type\": \"http\",\n \"method\": \"GET\",\n \"url\": \"https://example.com\"\n },\n {\n \"id\": \"step-2\",\n \"name\": \"step-",
"metrics": {
"length": 911,
"commands": 2,
"command_list": [
"**Step 2: Update your Workflow configuration**",
"If you don't have an `id` property, add it to your Workflow configuration. Here's an example:"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 6,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "AWS ECS 高分辨率指标 — 更快的自动扩缩容 (lesson-16-aws-ecs-high-resolution-metrics)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to update your ECS service to enable high-resolution metrics and configure Auto Scaling with a 10-second response time. Here are the exact commands to fix the issue:\n\n**Step 1: Enable high-resolution metrics**\n\n```bash\naws ecs update-service \\\n --cluster my-cluster \\\n --service my-service \\\n --enable-execute-command \\\n --network-configuration \"awsvpcConfiguration={...}\"\n```\n\nReplace `my-cluster` and `my-service` with your actual cluster and service names.\n\n**Step 2: Configure Auto Scaling with a 10-second response time**\n\n```bash\naws application-autoscaling put-scaling-policy \\\n --service-namespace ecs \\\n --scalable-dimension ecs:service:DesiredCount \\\n --resource-id service/my-cluster/my-service \\\n --policy-name high-res-scaling \\\n --policy-type TargetTrackingScaling \\\n --target-tracking-scaling-policy-configuration '{\n \"TargetValue\": 70.0,\n \"PredefinedMetricSpecification\": {\n \"PredefinedMetricType\": \"ECSServiceAverageCPUUtilization\"\n },\n \"ScaleInCooldown\": 60,\n \"ScaleOutCooldown\": 10\n }'\n```\n\n",
"metrics": {
"length": 1068,
"commands": 19,
"command_list": [
"aws ecs update-service \\",
"--cluster my-cluster \\",
"--service my-service \\",
"--enable-execute-command \\",
"--network-configuration \"awsvpcConfiguration={...}\""
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "AWS ECS 高分辨率指标 — 更快的自动扩缩容 (lesson-16-aws-ecs-high-resolution-metrics)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to the ECS task definition not being able to create high-resolution metrics. To resolve this issue, you need to update your ECS task definition to include the necessary metrics.\n\nHere's a step-by-step guide to fix the error:\n\n1. **Update your ECS task definition**:\n\n * First, update your ECS task definition to include the necessary metrics. You can do this by running the following command:\n\n ```bash\naws ecs update-task-definition --task-definition --family --container-definitions \n```\n\n Replace `` and `` with the actual names of your task definition and family, respectively.\n\n * For example, if your task definition is named `my-task-definition` and your family is named `my-family`, you would run the following command:\n\n ```bash\naws ecs update-task-definition --task-definition my-task-definition --family my-family --container-definitions '[{\"Name\": \"my-container\", \"Image\": \"my-image\", \"PortMappings\": [{\"ContainerPort\": 80}]}]'\n```\n\n2. **Enable high-resolution metrics**:\n\n * Next, enable high-resolution metrics for your",
"metrics": {
"length": 1210,
"commands": 2,
"command_list": [
"aws ecs update-task-definition --task-definition --family --container-definitions ",
"aws ecs update-task-definition --task-definition my-task-definition --family my-family --container-definitions '[{\"Name\": \"my-container\", \"Image\": \"my-image\", \"PortMappings\": [{\"ContainerPort\": 80}]}]'"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP — AI Agent 工具调用标准化协议 (lesson-17-segmentfault-mcp-standardization)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the MCP (Message Communication Protocol) standardization issue in your AI Agent tool. Here's a step-by-step guide to fix the issue:\n\n**Fixing MCP Standardization Issue**\n\n**Step 1: Install Required Packages**\n\nYou need to install the following packages to fix the MCP standardization issue:\n\n* `mcp-standardization`: This package provides the MCP standardization library.\n* `mcp-protocol`: This package provides the MCP protocol implementation.\n\nYou can install these packages using pip:\n\n```bash\npip install mcp-standardization mcp-protocol\n```\n\n**Step 2: Update MCP Configuration**\n\nYou need to update your MCP configuration file to use the standardization library. The configuration file is usually named `mcp_config.json`.\n\nOpen the `mcp_config.json` file in a text editor and update the following lines:\n\n```json\n{\n \"mcp_version\": \"1.0\",\n \"standardization\": {\n \"enabled\": true,\n \"library\": \"mcp-standardization\"\n }\n}\n```\n\n**Step 3: Restart Your AI Agent Tool**\n\nRestart your AI agent tool to apply the changes.\n\n**Step 4: Verify MCP Standardization**\n\nAfter restarting your",
"metrics": {
"length": 1149,
"commands": 1,
"command_list": [
"pip install mcp-standardization mcp-protocol"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP — AI Agent 工具调用标准化协议 (lesson-17-segmentfault-mcp-standardization)",
"condition": "with_lesson",
"status": 200,
"content": "The error message you're seeing is related to the MCP (MCP — AI Agent 工具调用标准化协议) protocol, which is designed to standardize the way AI agents interact with external tools. The issue seems to be with the way the MCP protocol is being used in your code.\n\nHere's a step-by-step guide to fixing the issue:\n\n**Step 1: Install the required libraries**\n\nYou'll need to install the `mcp` library, which provides the MCP protocol implementation. Run the following command:\n```bash\npip install mcp\n```\n**Step 2: Create a new MCP server**\n\nCreate a new file called `mcp_server.py` and add the following code:\n```python\nfrom mcp import Server, Tool\n\nserver = Server(\"my-tool\")\n\n@server.tool(\"query_database\")\nasync def query_database(sql: str) -> list:\n \"\"\"Execute a SQL query.\"\"\"\n # Your database logic here\n return []\n\n@server.tool(\"get_schema\")\nasync def get_schema(table: str) -> dict:\n \"\"\"Get table schema.\"\"\"\n # Your schema logic here\n return {}\n```\nThis code defines a new MCP server with two tools: `query_database` and `get_schema`. You'll need to",
"metrics": {
"length": 1062,
"commands": 1,
"command_list": [
"pip install mcp"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Redis → PostgreSQL 替换 — 缓存/PubSub/队列统一 (lesson-9-redis-postgresql-replacement)",
"condition": "with_lesson",
"status": 200,
"content": "**解决方案**\n\n为了实现 Redis 的所有功能,包括缓存、PubSub 和 队列,我们将使用 PostgreSQL 的特性进行替换。下面是具体的命令:\n\n**缓存实现**\n\n```sql\n-- 创建非日志表(无 WAL,更快)\nCREATE UNLOGGED TABLE cache (\n key TEXT PRIMARY KEY,\n value JSONB,\n expires_at TIMESTAMPTZ\n);\n\n-- 写入缓存\nINSERT INTO cache (key, value, expires_at)\nVALUES ('user:123', '{\"name\":\"Alice\"}', NOW() + INTERVAL '1 hour')\nON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, expires_at = EXCLUDED.expires_at;\n\n-- 读取缓存\nSELECT value FROM cache WHERE key = 'user:123' AND expires_at NOW();\n\n-- 清理过期(pg_cron 定时执行)\nCREATE OR REPLACE FUNCTION clean_cache()\nRETURNS TRIGGER AS $$\nBEGIN\n IF NEW.expires_at < NOW() THEN\n DELETE FROM cache WHERE expires_at < NOW();\n END IF;\n RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;\n\nCREATE TRIGGER clean_cache_trigger\nBEFORE DELETE ON cache\nFOR EACH ROW\nEXECUTE",
"metrics": {
"length": 820,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Redis → PostgreSQL 替换 — 缓存/PubSub/队列统一 (lesson-9-redis-postgresql-replacement)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to the fact that the `pg_cron` extension is not installed in your PostgreSQL database. This extension is required for the Pub/Sub and queue features.\n\nHere's a step-by-step solution to fix the issue:\n\n**Step 1: Install the `pg_cron` extension**\n\nYou can install the `pg_cron` extension using the following command in your PostgreSQL shell:\n\n```sql\nCREATE EXTENSION IF NOT EXISTS pg_cron;\n```\n\n**Step 2: Create a cron table**\n\nTo use the Pub/Sub and queue features, you need to create a cron table. You can do this using the following command:\n\n```sql\nCREATE TABLE IF NOT EXISTS mycron (\n id SERIAL PRIMARY KEY,\n name VARCHAR(255) NOT NULL,\n command VARCHAR(255) NOT NULL,\n interval TIME,\n enabled BOOLEAN DEFAULT TRUE\n);\n```\n\n**Step 3: Add a cron job**\n\nTo add a cron job, you can use the following command:\n\n```sql\nINSERT INTO mycron (name, command, interval)\nVALUES ('my_job', 'SELECT * FROM my_table', '*/5 * * * *');\n```\n\nThis will create a cron job that runs every 5 minutes and selects",
"metrics": {
"length": 1050,
"commands": 4,
"command_list": [
"**Step 2: Create a cron table**",
"To use the Pub/Sub and queue features, you need to create a cron table. You can do this using the following command:",
"**Step 3: Add a cron job**",
"To add a cron job, you can use the following command:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Before — inspect raw first line (lesson-file-line-number-corruption)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you can use the following command:\n\n```bash\nsed -i 's/^ [0-9]|//g' corrupted-file.ext\n```\n\nThis command uses `sed` to replace any leading spaces and digits (including pipes) at the start of each line with nothing, effectively removing them. The `g` flag at the end of the command ensures that all occurrences are replaced, not just the first one.\n\nHere's how you can verify the fix:\n\n1. Before: Inspect the raw first line of the corrupted file using `head -1 corrupted-file.ext | od -c | head -3`. This will show you the corrupted line.\n\n2. After: Confirm the first line is clean by simply inspecting it with `head -1 corrupted-file.ext`.\n\nTo prevent this issue from happening in the future, you should avoid using commands that prefix lines with line numbers when saving the file content, such as `cat -n`, `sed -n '...p'`, or `less -N`. Instead, use commands like `cat`, `less`, or `more` for viewing, and use a text editor or a programming language's built-in file handling mechanisms to save the file content.",
"metrics": {
"length": 1031,
"commands": 1,
"command_list": [
"sed -i 's/^ [0-9]|//g' corrupted-file.ext"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 3,
"lesson_hit_rate": 0.75
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Lesson Management Standardization — Naming, Content Sanitization, and Automated (lesson-management-standardization)",
"condition": "with_lesson",
"status": 200,
"content": "To address the issues mentioned in the problem, we'll perform the following steps:\n\n1. Generalize filenames and sanitize content.\n2. Update non-portable tags to standardize metadata.\n3. Implement automated submission standards.\n4. Remove plaintext secrets from documentation.\n\n**Phase 1: Bulk Cleanup**\n\nFirst, we'll rename files with project-specific prefixes and sanitize their content.\n\n1. Run the following script to rename files and sanitize content:\n```bash\npython scripts/generalize_lessons.py --pass 1\n```\nThis script will rename files with project-specific prefixes and remove hardcoded sensitive content.\n\n2. After the first pass, manually review the renamed files to ensure they are accurate and do not contain sensitive information.\n\n3. Run the following script to update Chinese filenames to English:\n```bash\npython scripts/generalize_lessons.py --pass 2\n```\nThis script will update the filenames to use English characters only.\n\n**Phase 2: Standardize Metadata**\n\nNext, we'll update non-portable tags to standardize metadata.\n\n1. Create a new file `metadata.yml` with the following content:\n```yml\nproject: misakanet\nnode: node-1\nseverity: info\n```\nThis file will serve as a template for standardized metadata",
"metrics": {
"length": 1223,
"commands": 2,
"command_list": [
"python scripts/generalize_lessons.py --pass 1",
"python scripts/generalize_lessons.py --pass 2"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Before — inspect raw first line (lesson-file-line-number-corruption)",
"condition": "plain",
"status": 200,
"content": "The error \"Before — inspect raw first line (lesson-file-line-number-corruption)\" typically occurs when there are issues with the line numbers in a file, which can be caused by various factors such as:\n\n- Unsaved changes to the file\n- Incorrect line numbers in the file\n- Issues with the file's encoding\n\nHere's a step-by-step guide to fix this error:\n\n**Method 1: Save and Reload the File**\n\n1. Save the file with any unsaved changes.\n2. Reload the file by clicking on \"Reload\" or pressing `Ctrl+R` (Windows/Linux) or `Cmd+R` (Mac).\n\n**Method 2: Check and Correct Line Numbers**\n\n1. Open the file in a text editor, such as Notepad (Windows) or TextEdit (Mac).\n2. Check the line numbers in the file and correct any errors.\n3. Save the file with the correct line numbers.\n\n**Method 3: Use a File Repair Tool**\n\n1. Download and install a file repair tool, such as:\n\t* Recuva (Windows)\n\t* Disk Utility (Mac)\n\t* File Repair (Windows, Mac, Linux)\n2. Run the file repair tool and select the file that contains the error.\n3",
"metrics": {
"length": 1015,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Lesson Management Standardization — Naming, Content Sanitization, and Automated (lesson-management-standardization)",
"condition": "plain",
"status": 200,
"content": "I don't see any error provided. However, I'll provide a general solution for the Lesson Management Standardization issue. If you provide the actual error message, I can give you a more precise fix.\n\nAssuming the issue is related to the Lesson Management Standardization, here's a general solution:\n\n**Solution:**\n\n1. Make sure that the lesson management standardization is properly configured in your application.\n2. Check that the naming convention for lessons is consistent and follows the standardization guidelines.\n3. Ensure that the content sanitization is enabled and properly configured to prevent any security vulnerabilities.\n\n**Example Commands:**\n\nIf you're using a Linux-based system, here are some example commands to help you troubleshoot and fix the issue:\n\n```bash\n# Check the lesson management standardization configuration\nsudo grep -i \"lesson-management-standardization\" /etc/config.yaml\n\n# Verify the naming convention for lessons\nsudo grep -i \"lesson-name\" /etc/config.yaml\n\n# Check the content sanitization configuration\nsudo grep -i \"content-sanitization\" /etc/config.yaml\n```\n\nIf you're using a Windows system, you can use the following commands:\n\n```bash\n# Check the lesson management standardization configuration\nGet-Content -Path C:\\config.yaml",
"metrics": {
"length": 1273,
"commands": 3,
"command_list": [
"sudo grep -i \"lesson-management-standardization\" /etc/config.yaml",
"sudo grep -i \"lesson-name\" /etc/config.yaml",
"sudo grep -i \"content-sanitization\" /etc/config.yaml"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Lesson Quality Requirements: failure-memory protocol Format (lesson-quality-requirements)",
"condition": "with_lesson",
"status": 200,
"content": "The error message indicates that the verification script is expecting a specific output format, but the actual output does not match this format. Specifically, the verification script is expecting a line count for the number of lines in the `lesson-quality-requirements.md` file, but the actual output only contains a string.\n\nTo fix this issue, you can modify the verification script to extract the line count from the output. Here's an updated version of the verification script:\n\n```bash\n#!/bin/bash\n\n# Run the lesson quality check\ncheck_lesson_quality.py lessons/contrib/lesson-quality-requirements.md\n\n# Check the score\nscore=$(score_lessons.py lessons/contrib/lesson-quality-requirements.md)\n\n# Check if the lesson appears in search results\nif grep -q \"lesson-quality-requirements\" search_index.txt; then\n search_result=\"Lesson appears in search results\"\nelse\n search_result=\"Lesson does not appear in search results\"\nfi\n\n# Check the structure\nif [[ $(check_lesson_structure.py lessons/contrib/lesson-quality-requirements.md) =~ \"Problem\" && $(check_lesson_structure.py lessons/contrib/lesson-quality-requirements.md) =~ \"Root Cause\" && $(check_lesson_structure.py lessons/contrib/lesson-quality-requirements",
"metrics": {
"length": 1216,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Lesson Quality Requirements: failure-memory protocol Format (lesson-quality-requirements)",
"condition": "plain",
"status": 200,
"content": "It seems like you're experiencing an issue with a YAML file, specifically the `lesson-quality-requirements` section. The error message \"failure-memory protocol Format\" is not a standard error message, but I'll assume it's related to a YAML validation error.\n\nTo fix this issue, you can try the following steps:\n\n1. Check the YAML file for any invalid characters or syntax errors:\n```bash\nyamllint lesson-quality-requirements.yaml\n```\nThis command will highlight any errors or warnings in the YAML file.\n\n2. If the above command doesn't find any issues, try to validate the YAML file using a YAML validator tool:\n```bash\nyaml validate lesson-quality-requirements.yaml\n```\nThis command will check the YAML file for any syntax errors and report them.\n\n3. If the above steps don't resolve the issue, try to recreate the `lesson-quality-requirements` section with a simple format:\n```yaml\nlesson-quality-requirements:\n - name: Test Requirement\n description: This is a test requirement.\n status: passed\n```\nThis should resolve the issue if the original YAML file had a more complex format.\n\nIf none of the above steps work, please provide the exact error message or the contents of the `lesson-quality-",
"metrics": {
"length": 1203,
"commands": 2,
"command_list": [
"yamllint lesson-quality-requirements.yaml",
"yaml validate lesson-quality-requirements.yaml"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Lesson Provenance Tracking: author, PR, source, merge history (lesson-provenance-tracking)",
"condition": "with_lesson",
"status": 200,
"content": "**Fix: Extend lesson schema with provenance fields and populate from git history**\n\n**Step 1: Update lesson schema**\n\nUpdate the `lesson` schema to include the provenance fields:\n```yaml\n---\n{\n \"title\": \"Lesson Provenance Tracking: author, PR, source, merge history\",\n \"domain\": \"devops\",\n \"tags\": [\"provenance\", \"metadata\", \"audit\", \"tracking\"],\n \"status\": \"published\",\n \"evidence_level\": \"E2\",\n \"source\": \"closed-pr-1031\",\n \"created\": \"2026-08-22\",\n \"provenance\": {\n \"author\": \"\",\n \"pr\": 0,\n \"merged_by\": \"\",\n \"edited_at\": \"\",\n \"edit_history\": []\n }\n}\n```\n**Step 2: Run the backfill script**\n\nRun the `backfill_provenance.py` script to populate the provenance fields from git history:\n```bash\npython scripts/backfill_provenance.py --lessons lessons\n```\nThis will populate the provenance fields with the corresponding values from the git history.\n\n**Step 3: Verify the results**\n\nVerify that the provenance fields are populated correctly:\n```",
"metrics": {
"length": 967,
"commands": 5,
"command_list": [
"**Step 2: Run the backfill script**",
"Run the `backfill_provenance.py` script to populate the provenance fields from git history:",
"This will populate the provenance fields with the corresponding values from the git history.",
"**Step 3: Verify the results**",
"Verify that the provenance fields are populated correctly:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Lesson Provenance Tracking: author, PR, source, merge history (lesson-provenance-tracking)",
"condition": "plain",
"status": 200,
"content": "The error you're experiencing is likely due to a missing index on the `source` column in your `lesson_provenance_tracking` table. Here's a concrete, actionable fix with exact commands:\n\n**Assumptions:**\n\n* You're using MySQL or PostgreSQL.\n* You have the necessary permissions to create indexes.\n\n**Fix:**\n\n1. **MySQL:**\n\n```sql\nCREATE INDEX idx_source ON lesson_provenance_tracking (source);\n```\n\n2. **PostgreSQL:**\n\n```sql\nCREATE INDEX idx_source ON lesson_provenance_tracking USING btree (source);\n```\n\n**Explanation:**\n\n* The `CREATE INDEX` command creates a new index on the specified column(s).\n* The `idx_source` name is arbitrary, but it's a good practice to use descriptive names for indexes.\n* The `ON lesson_provenance_tracking` clause specifies the table to create the index on.\n* The `(source)` clause specifies the column(s) to index.\n* In PostgreSQL, the `USING btree` clause specifies the indexing method, which is a B-tree index.\n\n**After creating the index:**\n\n* Run the following command to verify the index has been created:\n\n```sql\nSHOW INDEX FROM lesson_provenance_tracking;\n```\n\n",
"metrics": {
"length": 1102,
"commands": 9,
"command_list": [
"2. **PostgreSQL:**",
"**Explanation:**",
"* The `CREATE INDEX` command creates a new index on the specified column(s).",
"* The `idx_source` name is arbitrary, but it's a good practice to use descriptive names for indexes.",
"* The `ON lesson_provenance_tracking` clause specifies the table to create the index on."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 12,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP 协议 + Bedrock 实战 — Agent 外部工具调用标准化 (lesson-review-4-mcp-bedrock-integration)",
"condition": "with_lesson",
"status": 200,
"content": "The error you're experiencing is likely due to the MCP Server not being properly configured or the Agent not being able to connect to it. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Install the required dependencies**\n\nYou'll need to install the `mcp` and `boto3` libraries. Run the following commands:\n```bash\npip install mcp boto3\n```\n**Step 2: Define the MCP Server**\n\nCreate a new file called `mcp_server.py` and add the following code:\n```python\nfrom mcp import Server, Tool\nimport boto3\n\nserver = Server(\"my-tools\")\n\n@server.tool(\"read_s3_file\")\nasync def read_s3_file(bucket: str, key: str) -> str:\n \"\"\"Read a file from S3.\"\"\"\n s3 = boto3.client('s3')\n obj = s3.get_object(Bucket=bucket, Key=key)\n return obj['Body'].read().decode()\n\n@server.tool(\"query_dynamodb\")\nasync def query_dynamodb(table: str, key: str) -> dict:\n \"\"\"Query DynamoDB by partition key.\"\"\"\n dynamodb = boto3.resource('dynamodb')\n table = dynamodb.Table(table)\n",
"metrics": {
"length": 972,
"commands": 1,
"command_list": [
"pip install mcp boto3"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "EKS Kubernetes 版本回滚 — 安全升级集群 (lesson-review-5-eks-version-rollback)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering typically occurs when you're trying to roll back a version of your Kubernetes cluster in an Amazon EKS (Elastic Kubernetes Service) cluster. Here's a step-by-step guide to fix the issue:\n\n**Prerequisites:**\n\n* Make sure you have the AWS CLI installed and configured on your machine.\n* Ensure you have the necessary permissions to manage your EKS cluster.\n* Take a snapshot of your cluster before attempting to roll back.\n\n**Roll back to a previous version of your EKS cluster:**\n\n1. **List available versions:** Use the following command to list all available versions of your EKS cluster:\n\n```bash\naws eks describe-cluster --cluster-name --query 'cluster.versionHistoryList[]|{version, reason}'\n```\n\nReplace `` with your actual cluster name.\n\n2. **Choose the desired version:** Select the version you want to roll back to by looking at the `version` and `reason` columns in the output. For example, let's say you want to roll back to version `1.22.0`.\n\n3. **Update the cluster version:** Use the following command to update the cluster version:\n\n```bash\naws eks update-kubeconfig --name --",
"metrics": {
"length": 1164,
"commands": 1,
"command_list": [
"aws eks describe-cluster --cluster-name --query 'cluster.versionHistoryList[]|{version, reason}'"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cloudflare Monetization Gateway — x402 API 支付协议 (lesson-review-6-cloudflare-x402-monetization)",
"condition": "with_lesson",
"status": 200,
"content": "The error you're experiencing is due to the Cloudflare Monetization Gateway not being properly configured to accept payments from your AI Agent. To fix this, you'll need to follow these steps:\n\n1. Create a new file named `x402.json` in the root of your project with the following content:\n```json\n{\n \"name\": \"my-agent\",\n \"description\": \"My AI Agent\",\n \"inputSchema\": {},\n \"pricing\": {\n \"x402\": {\n \"amount\": \"0.01\",\n \"currency\": \"USDC\"\n }\n }\n}\n```\nThis file defines the pricing structure for your AI Agent using the x402 protocol.\n\n2. Run the following command to generate a payment proof:\n```bash\ncurl -X GET \\\n https://api.cloudflare.com/client/v1/x402/payments \\\n -H 'X-Auth-Token: YOUR_CLOUDFLARE_TOKEN' \\\n -H 'Content-Type: application/json' \\\n -d '{\"name\": \"my-agent\", \"description\": \"My AI Agent\", \"inputSchema\": {}, \"pricing\": {\"x402\": {\"amount\": \"0.01\", \"currency\": \"USDC\"}}}'\n```\nReplace `YOUR_CLOUDFL",
"metrics": {
"length": 935,
"commands": 2,
"command_list": [
"This file defines the pricing structure for your AI Agent using the x402 protocol.",
"2. Run the following command to generate a payment proof:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP 协议 + Bedrock 实战 — Agent 外部工具调用标准化 (lesson-review-4-mcp-bedrock-integration)",
"condition": "plain",
"status": 200,
"content": "I can guide you through the process of fixing the error, but I need more information about the error message you're encountering. The provided error message seems to be in Chinese, so I'll need you to translate it or provide more context.\n\nHowever, based on the topic \"MCP 协议 + Bedrock 实战 — Agent 外部工具调用标准化 (lesson-review-4-mcp-bedrock-integration)\", I'm assuming the error is related to integrating MCP (Microsoft Cloud Platform) with Bedrock, possibly involving an external tool.\n\nHere's a general approach to troubleshooting and fixing common errors related to MCP and Bedrock integration:\n\n1. Check the MCP and Bedrock documentation for any known issues or updates.\n2. Verify that all required dependencies and tools are installed and up-to-date.\n3. Review the code and configuration files for any syntax errors or inconsistencies.\n\nSince I don't have the exact error message, I'll provide a generic example of how to troubleshoot and fix a common issue:\n\n**Example:**\n\nLet's say the error message is:\n```\nError: MCP Agent not found\n```\nTo fix this issue, you can try the following steps:\n\n1. Check the MCP Agent installation:\n```bash\nmcp-agent --version\n```\n",
"metrics": {
"length": 1163,
"commands": 2,
"command_list": [
"Error: MCP Agent not found",
"mcp-agent --version"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "EKS Kubernetes 版本回滚 — 安全升级集群 (lesson-review-5-eks-version-rollback)",
"condition": "with_lesson",
"status": 200,
"content": "根据问题描述,EKS控制平面升级不可逆,这是开源K8s不支持的。为避免这种情况,AWS EKS支持控制平面版本回滚。以下是具体的修复步骤:\n\n1. **创建回滚点**(自动备份 etcd)\n ```bash\n aws eks update-cluster-config \\\n --name my-cluster \\\n --kubernetes-version 1.31\n ```\n\n2. **升级控制平面**\n ```bash\n aws eks update-cluster-version \\\n --name my-cluster \\\n --kubernetes-version 1.32\n ```\n\n3. **运行 smoke tests**\n ```bash\n kubectl --context=my-cluster get nodes\n ```\n\n4. **如果失败 → 回滚**\n ```bash\n aws eks rollback-cluster-version \\\n --name my-cluster \\\n --kubernetes-version 1.31\n ```\n\n5. **如果成功 → 升级节点组**\n ```bash\n for cluster in $(aws eks list-clusters --query 'clusters[]' --output text); do\n echo \"Upgrading $cluster...\"\n aws eks update-cluster-version --name \"$cluster",
"metrics": {
"length": 742,
"commands": 10,
"command_list": [
"aws eks update-cluster-config \\",
"--name my-cluster \\",
"--kubernetes-version 1.31",
"aws eks update-cluster-version \\",
"--name my-cluster \\"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 8,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cloudflare Monetization Gateway — x402 API 支付协议 (lesson-review-6-cloudflare-x402-monetization)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to a missing or incorrect configuration in your Cloudflare Monetization Gateway settings. To resolve this issue, follow these steps:\n\n**Step 1: Check your API key**\n\nMake sure you have the correct API key for your Cloudflare account. You can find it in the Cloudflare dashboard under \"Monetization\" > \"API keys\".\n\n**Step 2: Verify your x402 API settings**\n\nIn the Cloudflare dashboard, navigate to \"Monetization\" > \"Monetization Gateway\" > \"x402 API\". Ensure that:\n\n* The \"API endpoint\" is set to `https://api.cloudflare.com/client/v0/monetization/gateway/x402`\n* The \"API key\" is selected and the correct API key is entered\n* The \"PayPal\" or \"Stripe\" integration is enabled (depending on your payment gateway)\n* The \"Test mode\" is set to `false` (if you're deploying to production)\n\n**Step 3: Update your API settings (if necessary)**\n\nIf you've made changes to your API settings, you may need to update your code to reflect these changes. Check your API documentation for the latest information on x402 API settings.\n\n**Step 4:",
"metrics": {
"length": 1073,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Network Domain Lesson Template (lesson-template-network)",
"condition": "with_lesson",
"status": 200,
"content": "The error message \"Network Domain Lesson Template\" is not a specific error, but rather a title of a lesson template. However, based on the provided verified lesson, it seems that the issue is related to SSL certificate verification failure behind a corporate proxy.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Problem:** Agent fails to connect to external APIs behind corporate proxy with SSL inspection.\n\n**Symptoms:**\n\n* SSL: CERTIFICATE_VERIFY_FAILED\n\n**Root Cause:** Corporate proxy performs SSL inspection (man-in-the-middle), replacing original certificates with its own. Python's certifi bundle doesn't include the corporate CA.\n\n**Solution:**\n\n### Step 1: Identify the issue\n\nRun the following diagnostic commands to identify the issue:\n\n```bash\ncurl -v https://example.com\nnslookup example.com\nopenssl s_client -connect example.com:443\n```\n\nThese commands will help you understand the issue and verify the expected behavior.\n\n### Step 2: Apply the fix\n\nTo resolve the issue, follow these steps:\n\n1. **Export corporate CA certificate:**\n\n ```bash\nsecurity find-certificate -a -p /Library/Keychains/System.keychain corporate-ca.pem\n```\n\n This command will export the corporate CA certificate from the System",
"metrics": {
"length": 1234,
"commands": 4,
"command_list": [
"curl -v https://example.com",
"nslookup example.com",
"openssl s_client -connect example.com:443",
"security find-certificate -a -p /Library/Keychains/System.keychain corporate-ca.pem"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 4,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cloudflare Workflows Saga Rollback — Durable Multi-Step Compensation (lesson-review-7-cloudflare-saga-rollbacks)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the Cloudflare Workflows Saga Rollback issue, you need to ensure that the compensating operations for each step are properly implemented. Here's an updated version of the code with the necessary fixes:\n\n```javascript\n// Cloudflare Workflows saga rollback example\nexport default {\n async run(event, step) {\n // Step 1: Debit with rollback\n const debitResult = await step.do(\"debit-account-a\", {\n // rollback: compensating action if this step succeeds but later steps fail\n rollback: async () => {\n await step.do(\"credit-account-a-reversal\", {\n amount: debitResult.amount,\n accountId: \"A\"\n });\n }\n }, async () => {\n try {\n await debitFromAccount(\"A\", 100);\n return debitResult;\n } catch (error) {\n // If debit fails, revert to a previous state\n await step.do(\"credit-account-a-reversal\", {\n amount: 0,\n accountId: \"A\"\n });\n throw error;\n }\n });\n\n // Step 2: Credit (may fail)\n const creditResult = await step.do(\"credit-account-b\", {\n rollback: async () => {\n // If",
"metrics": {
"length": 1123,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Network Domain Lesson Template (lesson-template-network)",
"condition": "plain",
"status": 200,
"content": "The error \"Network Domain Lesson Template (lesson-template-network)\" is not a standard error message and seems to be related to a custom error or exception. However, I'll provide a general solution that might help resolve the issue.\n\nAssuming the error is related to a Django project, here are some steps you can try:\n\n1. Check your Django project's settings:\n\nOpen your `settings.py` file and look for any sections related to network domains or DNS settings. Make sure that the `ALLOWED_HOSTS` variable is properly configured.\n\n```python\nALLOWED_HOSTS = ['example.com', 'localhost', '127.0.0.1']\n```\n\n2. Check your virtual environment:\n\nMake sure your virtual environment is properly activated. If you're using a virtual environment, try activating it and then running your Django project.\n\n```bash\n# Activate the virtual environment\nsource myenv/bin/activate\n\n# Run your Django project\npython manage.py runserver\n```\n\n3. Check your DNS settings:\n\nIf you're using a custom domain, make sure that your DNS settings are correctly configured. You can check your DNS settings by contacting your DNS provider or hosting company.\n\n4. Clear cache and run migrations:\n\nClear your cache and run migrations to ensure that your",
"metrics": {
"length": 1217,
"commands": 2,
"command_list": [
"2. Check your virtual environment:",
"Make sure your virtual environment is properly activated. If you're using a virtual environment, try activating it and then running your Django project."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cloudflare Workflows Saga Rollback — Durable Multi-Step Compensation (lesson-review-7-cloudflare-saga-rollbacks)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to a Cloudflare Workflows Saga Rollback issue, specifically with Durable Multi-Step Compensation. Here's a step-by-step fix to resolve the problem:\n\n**Step 1: Delete the workflow**\n\n1. Log in to your Cloudflare account.\n2. Go to the Workflows tab.\n3. Find the workflow that's causing the error and click on the three dots next to it.\n4. Select \"Delete workflow\".\n\n**Step 2: Verify the deletion**\n\n1. After deleting the workflow, go back to the Workflows tab.\n2. Check if the deleted workflow is no longer listed.\n\n**Step 3: Create a new workflow**\n\n1. Click on the \"Create workflow\" button.\n2. Fill in the required information, such as the workflow name and description.\n3. Select \"Durable Multi-Step\" as the workflow type.\n\n**Step 4: Configure the workflow**\n\n1. In the workflow settings, make sure the \"Saga\" option is enabled.\n2. In the \"Saga\" section, ensure that the \"Rollback\" option is set to \"Enabled\".\n3. In the \"Compensation\" section, make sure that the \"Durable Multi-Step\" option is selected.\n\n",
"metrics": {
"length": 1047,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Maintainer Feedback Iteration — Address Blockers, Not Just Comments (maintainer-feedback-iteration)",
"condition": "with_lesson",
"status": 200,
"content": "To address the \"Maintainer Feedback Iteration — Address Blockers, Not Just Comments\" issue, we'll create a script that parses the maintainer's feedback, extracts the blockers, and fixes them. Here's a concrete, actionable fix with exact commands:\n\n**Fixing Maintainer Feedback Iteration**\n\nFirst, install the required GitHub CLI tools:\n```bash\ngh install\n```\n**Script: `fix_maintainer_feedback.sh`**\n```bash\n#!/bin/bash\n\n# Set the PR number\nPR_NUMBER=123456\n\n# Set the GitHub token (optional, but recommended for security)\nGITHUB_TOKEN=\"your_github_token_here\"\n\n# Function to extract blockers from a comment\nextract_blockers() {\n blockers=()\n while IFS= read -r line; do\n if [[ $line =~ \"remove\" || $line =~ \"not acceptable\" || $line =~ \"can be merged as\" ]]; then\n blockers+=(\"$line\")\n fi\n done <<< \"$1\"\n echo \"${blockers[@]}\"\n}\n\n# Function to fix blockers\nfix_blockers() {\n blockers=($(extract_blockers \"$1\"))\n for blocker in \"${blockers[@]}\"; do\n echo \"Fixing blocker: $",
"metrics": {
"length": 993,
"commands": 1,
"command_list": [
"gh install"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Context Mode — 98% Context Window Reduction for Claude Code (mcp-context-mode-98-reduction)",
"condition": "plain",
"status": 200,
"content": "The error message you're experiencing, `MCP Context Mode — 98% Context Window Reduction for Claude Code (mcp-context-mode-98-reduction)`, typically indicates that the context window size is too small for the current buffer size. To fix this issue, you can try increasing the context window size. Here's a concrete, actionable fix with exact commands:\n\n**For Visual Studio Code:**\n\n1. Open the Command Palette in Visual Studio Code by pressing `Ctrl + Shift + P` (Windows/Linux) or `Cmd + Shift + P` (Mac).\n2. Type \"MCP Context Mode: Increase Context Window Size\" in the Command Palette and select the option.\n3. Alternatively, you can also use the following command in the Terminal:\n\n ```bash\ncode --extensions.path=/path/to/your/extension --mcp-context-mode 100\n```\n\n Replace `/path/to/your/extension` with the actual path to the extension that's causing the issue.\n\n**For IntelliJ IDEA:**\n\n1. Open the Settings (or Preferences) dialog in IntelliJ IDEA by pressing `Ctrl + Shift + Alt + S` (Windows/Linux) or `Cmd + Shift + Alt + S` (Mac).\n2. In the Settings dialog, navigate",
"metrics": {
"length": 1080,
"commands": 1,
"command_list": [
"code --extensions.path=/path/to/your/extension --mcp-context-mode 100"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 3,
"lesson_hit_rate": 0.75
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Maintainer Feedback Iteration — Address Blockers, Not Just Comments (maintainer-feedback-iteration)",
"condition": "plain",
"status": 200,
"content": "The error you're experiencing is likely due to a conflict between the `maintainer-feedback-iteration` rule and another rule in your `.gitignore` file. The `maintainer-feedback-iteration` rule suggests that you should ignore files with names that contain the word \"blocker\" but not \"comment\". \n\nTo fix this issue, you can add the following lines to your `.gitignore` file:\n\n```bash\n# Ignore files that contain \"blocker\" but not \"comment\"\n*.blocker\n*.blocker-\n```\n\nHowever, the most effective solution is to modify your `.gitignore` file to include the exact file name that is causing the conflict. The exact command to do this depends on your operating system and how you're managing your Git repository. Here are a few examples:\n\n**Using Git Bash on Linux or macOS:**\n\n```bash\necho \"# Ignore file containing 'blocker' but not 'comment'\" >> .gitignore\necho \"file_with_blocker_but_no_comment.txt\" >> .gitignore\n```\n\n**Using PowerShell on Windows:**\n\n```bash\n$ignoreFile = \"C:\\Path\\To\\Your\\Gitignore\"\n$ignoreContent = \"# Ignore file containing 'blocker' but not 'comment'\"\n$",
"metrics": {
"length": 1071,
"commands": 4,
"command_list": [
"*.blocker",
"*.blocker-",
"echo \"# Ignore file containing 'blocker' but not 'comment'\" >> .gitignore",
"echo \"file_with_blocker_but_no_comment.txt\" >> .gitignore"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 9,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Endpoint 404: Zone Route Points to Worker Without MCP Implementation (mcp-endpoint-404-zone-route-misconfig)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a step-by-step guide to fixing the error:\n\n**Step 1: Update MCP endpoint routes**\n\nUse the following command to update the MCP endpoint routes:\n\n```bash\naws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://mcp-endpoint-404-zone-route-misconfig-updated.yaml\n```\n\n**Step 2: Deploy the updated worker**\n\nUse the following command to deploy the updated worker:\n\n```bash\naws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://updated-worker.yaml\n```\n\n**Step 3: Consolidate architecture**\n\nUpdate the misakanet-register-proxy worker to use the new MCP implementation:\n\n```bash\naws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://consolidated-worker.yaml\n```\n\n**Step 4: Verify MCP endpoint**\n\nTest the MCP endpoint using the following command:\n\n```bash\ncurl -X POST https://misakanet.org/mcp \\\n -H \"Content-Type: application/json\" \\\n -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\"\n```\n\nIf you encounter any issues, ensure that the MCP endpoint routes have been updated correctly and the worker",
"metrics": {
"length": 1117,
"commands": 6,
"command_list": [
"aws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://mcp-endpoint-404-zone-route-misconfig-updated.yaml",
"aws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://updated-worker.yaml",
"aws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://consolidated-worker.yaml",
"curl -X POST https://misakanet.org/mcp \\",
"-H \"Content-Type: application/json\" \\"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 0.4
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Context Mode — 98% Context Window Reduction for Claude Code (mcp-context-mode-98-reduction)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to implement a context mode architecture that compresses tool outputs. Here's a step-by-step guide to achieve this:\n\n**Step 1: Install required packages**\n\nRun the following command to install the required packages:\n```bash\nnpm install compress-archiver json-streamer\n```\n**Step 2: Create a context mode server**\n\nCreate a new file `context-mode-server.js` with the following code:\n```javascript\nconst express = require('express');\nconst { gzip, gunzip } = require('compress-archiver');\nconst { TransformStream } = require('stream');\nconst { Transform } = require('stream/Transform');\n\nconst app = express();\n\napp.use(express.json());\n\nconst compressionStrategies = {\n summarize: (data) => JSON.stringify({ summary: data.slice(0, 10) }),\n filter: (data) => JSON.stringify({ filtered: data.slice(0, 10) }),\n truncate: (data) => JSON.stringify({ truncated: data.slice(0, 10) }),\n structure: (data) => JSON.stringify({ structured: data.slice(0, 10) }),\n};\n\napp.post('/compress', (req, res) => {\n const { strategy } = req",
"metrics": {
"length": 1049,
"commands": 1,
"command_list": [
"npm install compress-archiver json-streamer"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Endpoint 404: Zone Route Points to Worker Without MCP Implementation (mcp-endpoint-404-zone-route-misconfig)",
"condition": "plain",
"status": 200,
"content": "The error message \"MCP Endpoint 404: Zone Route Points to Worker Without MCP Implementation (mcp-endpoint-404-zone-route-misconfig)\" typically occurs when the Azure Kubernetes Service (AKS) cluster is not properly configured to handle zone-aware routing.\n\nTo fix this issue, you need to enable zone-aware routing on your AKS cluster. Here are the steps:\n\n**Step 1: Update the Azure CLI**\n\nFirst, make sure you have the latest version of the Azure CLI installed. You can check by running:\n\n```bash\naz --version\n```\n\nIf you're using an older version, update it by running:\n\n```bash\naz upgrade\n```\n\n**Step 2: Enable Zone-Aware Routing**\n\nRun the following command to enable zone-aware routing on your AKS cluster:\n\n```bash\naz aks update --resource-group --name --enable-zone-aware-routing true\n```\n\nReplace `` and `` with the actual names of your resource group and AKS cluster.\n\n**Step 3: Update the Network Policies**\n\nZone-aware routing requires network policies to be updated to allow communication between pods in different zones. You can update the network policies using the following command:\n\n```",
"metrics": {
"length": 1174,
"commands": 3,
"command_list": [
"az --version",
"az upgrade",
"az aks update --resource-group --name --enable-zone-aware-routing true"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 1,
"lesson_hit_rate": 0.2
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Registry Readiness Requires QA Before Promotion (mcp-registry-readiness-requires-qa-before-promotion)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the Microsoft Compute Platform (MCP) registry readiness. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Ensure you have the Azure CLI installed on your machine. You can install it by running the following command:\n\n```bash\naz login\n```\n\n2. Verify that you have the necessary permissions to perform registry-related operations.\n\n**Step 1: Update the Azure Resource Manager (ARM) template**\n\nThe error might be caused by an outdated ARM template. Update the template to the latest version. Run the following command:\n\n```bash\naz group template update --name --resource-group --template-version '2022-05-01'\n```\n\nReplace `` and `` with the actual names of your template and resource group.\n\n**Step 2: Update the registry settings**\n\nUpdate the registry settings to ensure they are set to 'Ready' before promotion. Run the following command:\n\n```bash\naz vm registry update --resource-group --name --settings \"readyBeforePromotion=true\"\n```\n\nReplace `` and `` with the actual names of",
"metrics": {
"length": 1198,
"commands": 3,
"command_list": [
"az login",
"az group template update --name --resource-group --template-version '2022-05-01'",
"az vm registry update --resource-group --name --settings \"readyBeforePromotion=true\""
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Registry Readiness Requires QA Before Promotion (mcp-registry-readiness-requires-qa-before-promotion)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"MCP Registry Readiness Requires QA Before Promotion (mcp-registry-readiness-requires-qa-before-promotion)\", you need to follow the steps provided in the verified lesson. Here's a step-by-step guide:\n\n**Step 1: Define a registry readiness gate**\n\nBefore promoting a server, verify the following:\n\n* MCP smoke test passes\n* Windows/macOS/Linux instructions are clear\n* README uses real install commands only\n* Experimental tools are labeled experimental\n* Registry metadata has the right category and positioning\n\nYou can automate this process using a script or a tool like `mcp-registry-readiness-check`.\n\n**Step 2: Run chat-style QA**\n\nUse a matrix like the one provided in the lesson to test whether models actually use the MCP tool in realistic workflows. The matrix should have the following columns:\n\n| Query | Tool called? | Correct lesson? | Helpful answer? | No hallucination? |\n|---|---|---|---|---|\n| DCO failed on GitHub | | | | |\n| pip install times out | | | | |\n| secret scan blocked PR | | | | |\n| irrelevant negative query | | | | |\n\nYou can fill in the matrix with real data and scenarios to test the",
"metrics": {
"length": 1134,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP intake: agents submit failures without GitHub account (mcp-intake-no-account-submission)",
"condition": "plain",
"status": 200,
"content": "The error \"MCP intake: agents submit failures without GitHub account (mcp-intake-no-account-submission)\" typically occurs when an agent is submitting a failure report without a valid GitHub account associated with it.\n\nTo fix this issue, you'll need to update the agent's configuration to include a valid GitHub account. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Ensure you have a GitHub account and have created a personal access token with the necessary permissions.\n2. Familiarize yourself with the agent's configuration file (usually `agent.yml` or `agent.json`).\n\n**Step 1: Update the agent configuration**\n\nOpen the agent configuration file in a text editor and locate the `github` section. If it doesn't exist, add it:\n\n```yml\n# agent.yml (example)\ngithub:\n token: \"your-personal-access-token\"\n username: \"your-github-username\"\n```\n\nReplace `\"your-personal-access-token\"`, `\"your-github-username\"`, and other placeholders with your actual GitHub credentials.\n\n**Step 2: Save the changes**\n\nSave the updated configuration file.\n\n**Step 3: Restart the agent**\n\nRestart the agent process to apply the changes:\n\n```bash\n",
"metrics": {
"length": 1157,
"commands": 5,
"command_list": [
"Replace `\"your-personal-access-token\"`, `\"your-github-username\"`, and other placeholders with your actual GitHub credentials.",
"**Step 2: Save the changes**",
"Save the updated configuration file.",
"**Step 3: Restart the agent**",
"Restart the agent process to apply the changes:"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 6,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP intake: agents submit failures without GitHub account (mcp-intake-no-account-submission)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you'll need to add the `mcp-intake` tool to your environment. Here's a step-by-step guide:\n\n**Step 1: Install the `mcp-intake` tool**\n\nYou can install the `mcp-intake` tool using pip:\n```bash\npip install mcp-intake\n```\n**Step 2: Add the `mcp-intake` tool to your environment**\n\nAdd the following line to your `~/.bashrc` or `~/.zshrc` file to make the `mcp-intake` tool available in your shell:\n```bash\nexport PATH=$PATH:$(pwd)/mcp-intake\n```\nReplace `(pwd)` with the actual path to the `mcp-intake` tool.\n\n**Step 3: Configure the `mcp-intake` tool**\n\nCreate a configuration file for the `mcp-intake` tool:\n```bash\nmkdir -p ~/.mcp-intake\n```\nEdit the configuration file with the following contents:\n```yml\n---\nsubmit:\n type: json\n fields:\n - name: description\n type: string\n required: true\n - name: failure\n type: object\n ",
"metrics": {
"length": 867,
"commands": 3,
"command_list": [
"pip install mcp-intake",
"export PATH=$PATH:$(pwd)/mcp-intake",
"mkdir -p ~/.mcp-intake"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 17,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)",
"condition": "plain",
"status": 200,
"content": "The error message you're encountering, \"MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)\", is not specific to a programming language, but rather a command-line interface (CLI) error related to the MCP Server.\n\nHere's a step-by-step guide to fix the issue:\n\n**Prerequisites:**\n\n* Make sure you have the latest version of MCP Server installed on your system.\n* Familiarize yourself with the MCP Server command-line interface (CLI).\n\n**Fix:**\n\n1. **Check the MCP Server version:**\n\n * Open a command prompt or terminal and navigate to the directory where MCP Server is installed.\n * Run the following command to check the current version of MCP Server: `mcp-server --version`\n\n * Take note of the version number. If you're using an older version, consider updating to the latest version.\n\n2. **Disable stdio transmission:**\n\n * Run the following command to disable stdio transmission for the MCP Server: `mcp-server --disable-stdio-transmission`\n\n * If you want to enable stdio transmission again, run the following command: `mcp-server --enable-stdio-trans",
"metrics": {
"length": 1113,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)",
"condition": "with_lesson",
"status": 200,
"content": "The error message \"MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)\" indicates that the MCP Server is skipping the stdio transmission when directly calling the handler. This is a known issue in the MCP Server, and the solution is to directly call the JSON-RPC handler without starting a subprocess.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the MCP Server code**\n\nUpdate the `handle_request` function in the `scripts.mcp_server` module to return the result directly without writing to stdout:\n```python\n# scripts/mcp_server.py\n\ndef handle_request(request):\n # Your existing logic here\n return {\"result\": result}\n```\n**Step 2: Update the test code**\n\nUpdate the test code to use the `rpc` function directly without calling `handle_request` with `stdio=True`:\n```python\n# test_mcp_server.py\n\nfrom scripts.mcp_server import rpc\n\ndef test_search():\n resp = rpc(\"tools/call\", {\n \"name\": \"misakanet_search\",\n \"arguments\": {\"query\": \"test\"},\n })\n result = json.loads(resp[\"result\"][\"content\"][0][\"text\"])\n",
"metrics": {
"length": 1087,
"commands": 2,
"command_list": [
"**Step 2: Update the test code**",
"Update the test code to use the `rpc` function directly without calling `handle_request` with `stdio=True`:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Context Mode: Reducing Claude Code Context Consumption by 98% (mcp-server-that-reduces-claude-code-context-consumption-by-9)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the amount of Claude code context being consumed by the MCP server. This is typically a result of excessive logging or high system load. Here are some concrete, actionable steps to resolve this issue:\n\n**Step 1: Check the logging level**\n\nClaude code context is often consumed due to excessive logging. Check the logging level of the MCP server by running the following command:\n\n```bash\nmcp-server logs level\n```\n\nThis will display the current logging level. If it's set to DEBUG, try reducing it to INFO or WARNING.\n\n**Step 2: Increase the logging threshold**\n\nIf reducing the logging level doesn't solve the issue, you can increase the logging threshold to filter out unnecessary logs. Run the following command:\n\n```bash\nmcp-server logs level info\n```\n\nThis will set the logging level to INFO, which should reduce the amount of Claude code context consumed.\n\n**Step 3: Check for resource-intensive processes**\n\nHigh system load can also consume Claude code context. Check for resource-intensive processes running on the server:\n\n```bash\ntop -u $USER\n```\n\nLook for processes consuming excessive CPU or memory. You can also use `htop` or `sysdig` to monitor system activity.\n\n**",
"metrics": {
"length": 1224,
"commands": 3,
"command_list": [
"mcp-server logs level",
"mcp-server logs level info",
"top -u $USER"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 1,
"lesson_hit_rate": 0.2
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Context Mode: Reducing Claude Code Context Consumption by 98% (mcp-server-that-reduces-claude-code-context-consumption-by-9)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to implement the Context Mode solution provided. Here are the concrete, actionable steps with exact commands:\n\n**Step 1: Create a PreToolUse hook**\n\nThis hook will intercept tool outputs and process them in an isolated sandbox.\n\nCreate a new file `pre_tool_use.py` in the `mcp-server` directory:\n```python\nimport os\nimport subprocess\nimport json\n\ndef pre_tool_use(event):\n # Get the tool name and output\n tool_name = event['tool_name']\n output = event['output']\n\n # Process the output in an isolated sandbox\n process = subprocess.Popen(['python', '-c', f'import io; print(io.StringIO(output))'], stdout=subprocess.PIPE)\n stdout, _ = process.communicate()\n\n # Return the processed output\n return json.loads(stdout.decode('utf-8'))\n\nevent = {'tool_name': 'your_tool_name', 'output': 'your_tool_output'}\nresult = pre_tool_use(event)\nprint(result)\n```\nReplace `your_tool_name` and `your_tool_output` with the actual values.\n\n**Step 2: Register the PreToolUse hook**\n\nIn the `mcp-server` directory, create a new file `config.py`:\n",
"metrics": {
"length": 1076,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 0.4
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP tool ERROR convention — inconsistency between failure paths causes silent (mcp-tool-error-convention-inconsistency)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to update the `_claude()` function in the `generate_commit_message` module to include the `ERROR:` prefix in the timeout return string. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the `_claude()` function**\n\nOpen the `generate_commit_message.py` file and update the `_claude()` function as follows:\n```python\ndef _claude():\n # ... (rest of the function remains the same)\n\n except subprocess.TimeoutExpired:\n return \"ERROR: claude -p timed out after 20s\"\n```\n**Step 2: Run the fix**\n\nRun the following commands to verify the fix:\n```bash\ngit status --short | head -5\ngit log --oneline -3\n```\nThese commands will check if the fix has been applied correctly.\n\n**Expected Output:**\n\nThe output should be:\n```\n(status)\n(recent)\n```\nThis indicates that the fix has been successful.\n\n**Verification**\n\nTo further verify the fix, you can run the following command:\n```bash\nmcp-tool --version\n```\nThis will check if the `ERROR:` prefix has been added to the timeout return string.\n\nIf everything is correct, you should",
"metrics": {
"length": 1078,
"commands": 8,
"command_list": [
"**Step 2: Run the fix**",
"Run the following commands to verify the fix:",
"These commands will check if the fix has been applied correctly.",
"**Expected Output:**",
"The output should be:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 14,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "mcporter OAuth Authorization Must Be Serial: Concurrent Auth Causes client_id/state (mcporter-oauth-must-be-serial)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the \"mcporter OAuth Authorization Must Be Serial\" error, follow these steps:\n\n**Step 1: Run mcporter auth commands one at a time**\n\nTo avoid concurrent auth processes, run each `mcporter auth` command individually, completing the entire authorization flow (browser authorization + callback + token save) before starting the next one.\n\n```bash\n# Run the first auth command\nmcporter auth --client-id --redirect-uri --scope --code-verifier \n\n# Run the second auth command\nmcporter auth --client-id --redirect-uri --scope --code-verifier \n```\n\n**Step 2: Delete corrupted vault entries and clean token cache directory (if necessary)**\n\nIf you've already run multiple auth commands concurrently, delete the corrupted vault entries and clean the token cache directory.\n\n```bash\n# Delete vault entries for affected servers\nrm ~/.mcporter/credentials.json\n\n# Clean token cache directory\nrm -rf state.txt code_verifier.txt tokens.json\n```\n\n**Step 3: Give each server independent tokenCacheDir**\n\nTo reduce shared file conflicts, add the `--token-cache-dir",
"metrics": {
"length": 1152,
"commands": 4,
"command_list": [
"mcporter auth --client-id --redirect-uri --scope --code-verifier ",
"mcporter auth --client-id --redirect-uri --scope --code-verifier ",
"rm ~/.mcporter/credentials.json",
"rm -rf state.txt code_verifier.txt tokens.json"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 1,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MCP tool ERROR convention — inconsistency between failure paths causes silent (mcp-tool-error-convention-inconsistency)",
"condition": "plain",
"status": 200,
"content": "The error message \"MCP tool ERROR convention — inconsistency between failure paths causes silent (mcp-tool-error-convention-inconsistency)\" typically occurs when there's a mismatch in the error handling conventions used in different parts of the code. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Identify the inconsistent error handling**\n\nTo identify the inconsistent error handling, you'll need to check the error handling conventions used in different parts of the code. You can do this by looking at the `try-catch` blocks and error handling code in your project.\n\n**Step 2: Update error handling conventions**\n\nTo fix the error, you'll need to update the error handling conventions to be consistent throughout the code. Here are some steps to follow:\n\n**Step 3: Update the `try-catch` block**\n\nOpen the `try-catch` block where the error is occurring and update the error handling to match the convention used elsewhere in the code. For example, if you're using `try-catch` blocks with `catch` clauses, update the `catch` clause to match the convention used elsewhere in the code.\n\n```bash\n# Before\ntry {\n // code that may throw an error\n} catch (Exception e) {\n //",
"metrics": {
"length": 1197,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "mcporter OAuth Authorization Must Be Serial: Concurrent Auth Causes client_id/state (mcporter-oauth-must-be-serial)",
"condition": "plain",
"status": 200,
"content": "The error \"OAuth Authorization Must Be Serial: Concurrent Auth Causes client_id/state (mcporter-oauth-must-be-serial)\" typically occurs when you're trying to authenticate with the mcporter OAuth API in a concurrent or parallel environment, such as a multi-threaded or multi-process application.\n\nHere's a concrete, actionable fix with exact commands to resolve this issue:\n\n**Step 1: Understand the issue**\n\nThe mcporter OAuth API requires that the client ID and state be sent in a serial, non-concurrent manner. This means that you should not try to authenticate with the API from multiple threads or processes simultaneously.\n\n**Step 2: Use a serial authentication mechanism**\n\nTo resolve this issue, you can use a serial authentication mechanism, such as using a lock or a semaphore to ensure that only one thread or process can authenticate with the API at a time.\n\nHere's an example using Python and the `threading` module:\n\n```python\nimport threading\n\nclass McporterOAuth:\n def __init__(self, client_id, client_secret, redirect_uri):\n self.client_id = client_id\n self.client_secret = client_secret\n self.redirect_uri = redirect_uri\n self.lock = threading.Lock()\n\n def authenticate(self):\n with self.lock:\n ",
"metrics": {
"length": 1263,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 1,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag (misakanet-heal-ux-gap-queue-lesson-flag-mismatch)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the CLI flag mismatch issue, you need to update the suggested commands in `search_knowledge.py` to match the actual flags used in `queue_lesson.py`. Here are the corrected commands:\n\n1. Update the `-f` flag to `--file`:\n\n Original suggested command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag -f tests/fixtures/openclaw/unmatched_.log`\n\n Corrected command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag --file tests/fixtures/openclaw/unmatched_.log`\n\n2. Update the `-d` flag to `--domain`:\n\n Original suggested command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag -d openclaw`\n\n Corrected command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag --domain openclaw`\n\n3. Update the domain placeholder:\n\n Original suggested command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag `\n\n Corrected command: `MisakaNet --heal UX",
"metrics": {
"length": 1026,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 11,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag (misakanet-heal-ux-gap-queue-lesson-flag-mismatch)",
"condition": "plain",
"status": 200,
"content": "The error message indicates that there is a mismatch between the flag used in the `MisakaNet` command and the flag used in the `queue_lesson.py` script.\n\nHere's a step-by-step fix:\n\n**Step 1: Check the flags used in the `MisakaNet` command**\n\nRun the following command to see the flags used in the `MisakaNet` command:\n```bash\nMisakaNet --help\n```\nThis will display the available flags for the `MisakaNet` command.\n\n**Step 2: Check the flags used in the `queue_lesson.py` script**\n\nOpen the `queue_lesson.py` script in a text editor or IDE. Look for the flags used in the script. You can use the following command to see the flags used in the script:\n```bash\npython queue_lesson.py --help\n```\nThis will display the available flags for the `queue_lesson.py` script.\n\n**Step 3: Identify the mismatch**\n\nCompare the flags used in the `MisakaNet` command and the `queue_lesson.py` script. Identify the flag that is used differently in each script.\n\n**Step 4: Correct the mismatch**\n\nOnce you have identified the mismatch, correct it by updating the",
"metrics": {
"length": 1044,
"commands": 2,
"command_list": [
"MisakaNet --help",
"python queue_lesson.py --help"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 13,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "模型输出截断 / JSON 解析失败Handling (model-output-fix)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"模型输出截断 / JSON 解析失败Handling (model-output-fix)\", you can follow these steps:\n\n**Step 1: Increase the `max_tokens` limit**\n\nIn your code, increase the `max_tokens` limit to a higher value, such as 8192 or more. You can do this by adding the following line of code:\n```python\nmax_tokens=8192\n```\nAdd this line of code to your `client.messages.create()` function.\n\n**Step 2: Add a prompt to request complete JSON output**\n\nModify your prompt to request complete JSON output, like this:\n```python\nprompt=\"输出完整的 JSON,不要省略任何字段\"\n```\nAdd this line of code to your `client.messages.create()` function.\n\n**Step 3: Implement a function to detect truncated responses**\n\nCreate a function to detect truncated responses, like this:\n```python\ndef is_truncated(response_text: str) -> bool:\n \"\"\"检查是否被截断\"\"\"\n truncated_markers = [\n '...', 省略号结尾\n '...\"', 字符串未闭合\n '{...}', 对象被省略\n '\"', 字符串未闭合\n ]\n",
"metrics": {
"length": 971,
"commands": 6,
"command_list": [
"Add this line of code to your `client.messages.create()` function.",
"**Step 2: Add a prompt to request complete JSON output**",
"Modify your prompt to request complete JSON output, like this:",
"Add this line of code to your `client.messages.create()` function.",
"**Step 3: Implement a function to detect truncated responses**"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "模型输出截断 / JSON 解析失败Handling (model-output-fix)",
"condition": "plain",
"status": 200,
"content": "The error \"模型输出截断 / JSON 解析失败\" (which translates to \"Model output truncation / JSON parsing failed\" in English) is often encountered when there's a problem with the model output or the JSON parsing process.\n\nHere's a concrete and actionable fix with exact commands:\n\n**Fix 1: Check the Model Output**\n\n1. Check the model's output to ensure it's not truncated or corrupted. You can do this by printing the model's output:\n```bash\npython -c \"import your_model; print(your_model.predict(input_data))\"\n```\nReplace `your_model` with the actual name of your model and `input_data` with the input data that generated the output.\n\n**Fix 2: Verify the JSON Parsing**\n\n1. Check the JSON parsing process to ensure it's working correctly. You can do this by printing the JSON output:\n```bash\npython -c \"import your_model; import json; print(json.dumps(your_model.predict(input_data)))\"\n```\nReplace `your_model` with the actual name of your model and `input_data` with the input data that generated the output.\n\n**Fix 3: Check for Encoding Issues**\n\n1. Check if there are any encoding issues with the model output or JSON parsing",
"metrics": {
"length": 1116,
"commands": 2,
"command_list": [
"python -c \"import your_model; print(your_model.predict(input_data))\"",
"python -c \"import your_model; import json; print(json.dumps(your_model.predict(input_data)))\""
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Multi-Forum Scraping Architecture — API vs Playwright (multi-forum-scraping-architecture)",
"condition": "with_lesson",
"status": 200,
"content": "The error you're experiencing seems to be related to the usage of Playwright in your code. Playwright is a browser automation library, and it requires a browser instance to be launched before you can use it. However, in your example, you're trying to import Playwright without specifying the browser type or launching the browser.\n\nHere's a concrete, actionable fix for your code:\n\n**Step 1: Install Playwright**\n\nYou need to install Playwright using npm or yarn. Run the following command in your terminal:\n\n```bash\nnpm install playwright\n```\n\nor\n\n```bash\nyarn add playwright\n```\n\n**Step 2: Import Playwright and specify the browser type**\n\nIn your JavaScript file, import Playwright and specify the browser type. Here's an example:\n\n```javascript\nconst { chromium } = require('playwright');\n\n(async () => {\n const browser = await chromium.launch();\n const context = await browser.newContext();\n const page = await context.newPage();\n\n // Your code here\n await page.goto('https://example.com');\n await page.waitForSelector('your-selector');\n await page.screenshot({ path: 'screenshot.png' });\n\n await browser.close();\n})();\n```\n\nReplace `'https://example.com'`",
"metrics": {
"length": 1169,
"commands": 2,
"command_list": [
"npm install playwright",
"yarn add playwright"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Multi-Forum Scraping Architecture — API vs Playwright (multi-forum-scraping-architecture)",
"condition": "plain",
"status": 200,
"content": "I don't see any error in your prompt. However, I'll provide a general solution for the multi-forum scraping architecture using API vs Playwright.\n\n**API Approach:**\n\nIf you're using APIs for scraping, ensure that you're respecting the terms of service of each forum. Here's a general approach:\n\n1. Inspect the API endpoint for each forum to understand the request parameters and response format.\n2. Use a programming language like Python or JavaScript to make HTTP requests to the API endpoints.\n3. Parse the JSON responses and extract the required data.\n\nHere's a simple example using Python and the `requests` library:\n\n```bash\npip install requests\n```\n\n```python\nimport requests\n\n# Define the API endpoints and parameters\nforums = {\n 'Reddit': {'url': 'https://www.reddit.com/r/{name}/.json', 'params': {'limit': 100}},\n 'Stack Overflow': {'url': 'https://api.stackexchange.com/2.3/questions?order=desc&sort=activity&site=stackoverflow', 'params': {'limit': 100}}\n}\n\n# Loop through each forum and extract data\nfor name, api in forums.items():\n response = requests.get(api['url'], params=api['params",
"metrics": {
"length": 1110,
"commands": 1,
"command_list": [
"pip install requests"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Fix Node.js ECONNRESET Connection Reset Error in n8n Webhook HTTP Requests (n8n-nodejs-econnreset-connection-reset-fix)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a step-by-step guide to fix the ECONNRESET connection reset error in n8n Webhook HTTP Requests:\n\n**Step 1: Increase Keep-Alive Socket Expiration**\n\nUpdate the `keepaliveTimeout` setting in the `n8n.json` file to a higher value.\n\n```bash\nsudo nano /usr/local/etc/n8n/n8n.json\n```\n\nAdd the following line to the file:\n\n```json\n\"keepaliveTimeout\": 300\n```\n\nThis sets the keep-alive socket expiration to 5 minutes.\n\n**Step 2: Configure Reverse Proxy & Firewall Timeouts**\n\nCheck the reverse proxy and firewall settings to ensure they are not dropping long-polling connections.\n\nFor Nginx:\n\n```bash\nsudo nano /etc/nginx/nginx.conf\n```\n\nAdd the following lines to the file:\n\n```nginx\nhttp {\n ...\n keepalive_timeout 300; # 5 minutes\n proxy_read_timeout 300; # 5 minutes\n ...\n}\n```\n\nFor Traefik:\n\n```bash\nsudo traefik configuration save\n```\n\nAdd the following lines to the `traefik.yml` file:\n\n```yml\nlog:\n level: DEBUG\n\nproviders:\n docker:\n",
"metrics": {
"length": 956,
"commands": 8,
"command_list": [
"sudo nano /usr/local/etc/n8n/n8n.json",
"This sets the keep-alive socket expiration to 5 minutes.",
"**Step 2: Configure Reverse Proxy & Firewall Timeouts**",
"Check the reverse proxy and firewall settings to ensure they are not dropping long-polling connections.",
"For Nginx:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 13,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Fix Node.js ECONNRESET Connection Reset Error in n8n Webhook HTTP Requests (n8n-nodejs-econnreset-connection-reset-fix)",
"condition": "plain",
"status": 200,
"content": "The ECONNRESET error in Node.js is usually caused by a temporary network issue or a misconfigured connection. Here's a concrete, actionable fix for the n8n Webhook HTTP requests:\n\n**Step 1: Update n8n to the latest version**\n\nFirst, make sure you're running the latest version of n8n. You can update n8n using the following command:\n\n```bash\nn8n upgrade\n```\n\n**Step 2: Update the HTTP client**\n\nThe `econnreset` error can be caused by an outdated HTTP client. You can update the HTTP client using the following command:\n\n```bash\nnpm install --save @n8n/workflow-engine@latest @n8n/core@latest\n```\n\n**Step 3: Configure the HTTP client**\n\nCreate a new file named `http-client-config.js` in the `config` directory of your n8n installation (usually `~/.n8n/config/http-client-config.js`):\n\n```javascript\nmodule.exports = {\n maxRedirects: 5,\n maxRetries: 3,\n retryDelay: 500,\n timeout: 10000,\n};\n```\n\nThis configuration sets the maximum redirects, retries, and retry delay for the HTTP client",
"metrics": {
"length": 991,
"commands": 2,
"command_list": [
"n8n upgrade",
"npm install --save @n8n/workflow-engine@latest @n8n/core@latest"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 1,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "npm install EACCES permission error on Linux and macOS (npm-eacces-permission-error-linux)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the EACCES permission error when installing packages globally with npm, follow these steps:\n\n**Step 1: Configure npm to use a user-owned global directory**\n\nOpen a terminal and run the following commands:\n\n```bash\n# Create a new directory for the global npm installation\nmkdir -p ~/.npm-global\n\n# Set the prefix for npm to use the new global directory\nnpm config set prefix ~/.npm-global\n\n# Add the new prefix to the PATH environment variable\nexport PATH=~/.npm-global/bin:$PATH\n```\n\n**Step 2: Add the PATH line to your shell configuration file**\n\nYou need to add the PATH line to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.profile`) to make the changes persistent. Run one of the following commands to add the line:\n\n```bash\n# For Bash shell\necho \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.bashrc\n\n# For Zsh shell\necho \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.zshrc\n```\n\n**Step 3: Verify the new configuration**\n\nRun the following commands to verify the changes:\n\n```bash\n# Print the updated PATH variable",
"metrics": {
"length": 1045,
"commands": 5,
"command_list": [
"mkdir -p ~/.npm-global",
"npm config set prefix ~/.npm-global",
"export PATH=~/.npm-global/bin:$PATH",
"echo \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.bashrc",
"echo \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.zshrc"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Node.js missing require inside try/catch silently kills win32 code path (nodejs-missing-require-inside-try-catch)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the issue, you need to move the `require` statements outside the `try/catch` block. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Move require statements to top level**\n\nOpen your JavaScript file and move the `require` statements for `os` and `path` to the top level, outside the `try/catch` block:\n\n```javascript\nconst os = require(\"node:os\");\nconst path = require(\"node:path\");\n\ntry {\n const tmpDir = os.tmpdir();\n const marker = path.join(tmpDir, \"marker.txt\");\n // spawn handler...\n} catch (_) {\n // Swallows ALL errors, including ReferenceError from missing require\n}\n```\n\n**Step 2: Verify the fix**\n\nAfter making the change, run your tests again to verify that the issue is resolved. You should no longer see the \"marker: not found\" error.\n\n**Additional suggestion**\n\nTo further improve the code, you can consider adding a `console.error` statement inside the `catch` block to log the error and provide more insight into what's happening:\n\n```javascript\ntry {\n const tmpDir = os.tmpdir();\n const marker = path.join(tmpDir, \"marker.txt\");\n ",
"metrics": {
"length": 1078,
"commands": 4,
"command_list": [
"**Step 2: Verify the fix**",
"After making the change, run your tests again to verify that the issue is resolved. You should no longer see the \"marker: not found\" error.",
"**Additional suggestion**",
"To further improve the code, you can consider adding a `console.error` statement inside the `catch` block to log the error and provide more insight into what's happening:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "npm install EACCES permission error on Linux and macOS (npm-eacces-permission-error-linux)",
"condition": "plain",
"status": 200,
"content": "**Fixing EACCES Permission Error with npm on Linux and macOS**\n\nThe EACCES permission error occurs when npm is unable to access a file or directory due to insufficient permissions. Here's a step-by-step solution to resolve this issue:\n\n**Method 1: Change the ownership of the npm installation directory**\n\n1. **Find the npm installation directory**: Run the following command to find the path where npm is installed:\n ```bash\nnpm config get prefix\n```\n This will give you the path where npm is installed.\n\n2. **Change the ownership of the npm installation directory**:\n ```bash\nsudo chown -R $USER:$USER /path/to/npm/installation/directory\n```\n Replace `/path/to/npm/installation/directory` with the actual path returned by `npm config get prefix`.\n\n3. **Verify the ownership**:\n ```bash\nls -ld /path/to/npm/installation/directory\n```\n This should display the ownership of the directory as `rwxr-xr-x` (owner has read, write, and execute permissions, group has read and execute permissions, others have read and execute permissions).\n\n**Method 2: Use `sudo` with `npm install`**\n\n1. **Run",
"metrics": {
"length": 1100,
"commands": 3,
"command_list": [
"npm config get prefix",
"sudo chown -R $USER:$USER /path/to/npm/installation/directory",
"ls -ld /path/to/npm/installation/directory"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Node.js missing require inside try/catch silently kills win32 code path (nodejs-missing-require-inside-try-catch)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to a known issue in Node.js where it silently kills the child process when it encounters a `require` statement inside a `try/catch` block. This can happen when running Windows-specific code inside a Node.js script.\n\nTo fix this issue, you can use the following approach:\n\n**Method 1: Using `process.on('exit')`**\n\nCreate a new file named `child_process.js` and add the following code:\n```javascript\nconst fs = require('fs');\nconst childProcess = require('child_process');\n\n// Run the Windows-specific code\nconst child = childProcess.spawn('your-win32-code-path.exe');\n\n// Catch the exit event\nprocess.on('exit', (code) => {\n if (code === 0) {\n console.log('Windows-specific code executed successfully');\n } else {\n console.log('Error executing Windows-specific code');\n }\n});\n```\nReplace `'your-win32-code-path.exe'` with the actual path to your Windows-specific code.\n\n**Method 2: Using `child_process.execFileSync`**\n\nCreate a new file named `child_process.js` and add the following code:\n```javascript\nconst fs = require('fs');\nconst childProcess = require('child_process');\n\n",
"metrics": {
"length": 1125,
"commands": 3,
"command_list": [
"Replace `'your-win32-code-path.exe'` with the actual path to your Windows-specific code.",
"**Method 2: Using `child_process.execFileSync`**",
"Create a new file named `child_process.js` and add the following code:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "OpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)",
"condition": "with_lesson",
"status": 200,
"content": "The error message you're encountering is related to the OpenAI compatible API call format. To fix this, you need to modify your API call to match the format of the service you're using.\n\nAssuming you're using the Ollama service, here's the corrected code:\n\n```bash\npython\nimport requests\nimport json\n\nurl = \"http://localhost:11434/v1/chat/completions\"\nheaders = {\"Content-Type\": \"application/json\"}\n\npayload = {\n \"model_id\": \"qwen2.5:7b\",\n \"messages\": [\n {\"role\": \"system\", \"content\": \"你是专业助手\"},\n {\"role\": \"user\", \"content\": \"你好\"}\n ],\n \"temperature\": 0.7,\n \"max_tokens\": 1024,\n \"stream\": False\n}\n\nresp = requests.post(url, headers=headers, json=payload)\ndata = resp.json()\nprint(data[\"choices\"][0][\"message\"][\"content\"])\n```\n\nHere's a brief explanation of the changes:\n\n- `model` is replaced with `model_id` as per the Ollama service's API documentation.\n- The `model` parameter should be set to the ID of the model you want to use,",
"metrics": {
"length": 964,
"commands": 18,
"command_list": [
"python",
"import requests",
"import json",
"url = \"http://localhost:11434/v1/chat/completions\"",
"headers = {\"Content-Type\": \"application/json\"}"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 4,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "OpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)",
"condition": "plain",
"status": 200,
"content": "The error message you're encountering is due to the OpenAI API requiring a specific format for API calls. Here's how to fix it:\n\n**Error Message:**\n\n```\nOpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)\n```\n\n**Fix:**\n\nThe error message indicates that the API call is not in the correct format. To fix this, you'll need to modify your API call to use the OpenAI compatible API format.\n\n**API Call Format:**\n\nThe OpenAI API expects the following format for API calls:\n\n```bash\ncurl -X POST \\\n https://api.openai.com/v1/models/{model_id}/predictions \\\n -H 'Content-Type: application/json' \\\n -d '{\"input_text\": \"Your input text here\"}'\n```\n\nReplace `{model_id}` with the actual ID of the OpenAI model you're using.\n\n**Example:**\n\nLet's say you're using the `text-api` model. You can make a prediction like this:\n\n```bash\ncurl -X POST \\\n https://api.openai.com/v1/models/text-api/predictions \\\n -H 'Content-Type: application/json' \\\n -d '{\"input_text\": \"Your text here\"}'\n``",
"metrics": {
"length": 977,
"commands": 5,
"command_list": [
"OpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)",
"curl -X POST \\",
"https://api.openai.com/v1/models/{model_id}/predictions \\",
"-H 'Content-Type: application/json' \\",
"-d '{\"input_text\": \"Your input text here\"}'"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "OPENCLAW_ERROR_HANDLER — Standard protocol for CLI fatal error external hooks (openclaw-fatal-error-hook-protocol)",
"condition": "with_lesson",
"status": 200,
"content": "To address the issues with `OPENCLAW_ERROR_HANDLER`, you can create a custom handler that follows a secure protocol. Here's an example of how to implement it:\n\n**Create a custom handler**\n\nCreate a new file named `openclaw-fatal-error-handler.js` with the following content:\n```javascript\nconst fs = require('fs');\nconst path = require('path');\nconst { spawn } = require('child_process');\nconst { stdin, stdout, stderr } = require('process');\n\nconst handler = async (error, stdout, stderr) => {\n // Create a secure log file\n const logFilePath = '/var/log/openclaw-errors.log';\n fs.writeFileSync(logFilePath, `Error: ${error.message}\\n`);\n\n // Send the error message to a secure webhook\n const webhookUrl = 'https://your-webhook-url.com/openclaw-error';\n const headers = { 'Content-Type': 'application/json' };\n const body = JSON.stringify({ error: error.message });\n const options = { method: 'POST', headers, body };\n const response = await fetch(webhookUrl, options);\n if (!response.ok) {\n console.error(`Failed to send error to webhook: ${response.status}`);\n }\n\n ",
"metrics": {
"length": 1081,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 4,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "openclaw gateway dynamic module missing (openclaw-gateway-dynamic-module-missing)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error \"openclaw gateway dynamic module missing (openclaw-gateway-dynamic-module-missing)\", you need to restart the OpenClaw Gateway service and update the credentials file.\n\nHere are the steps:\n\n1. Restart the OpenClaw Gateway service:\n```bash\nsystemctl --user restart openclaw-gateway\n```\nThis will restart the service and regenerate the dynamic modules.\n\n2. Update the credentials file:\n```json\n{\n \"version\": 1,\n \"allowFrom\": [\n \"ou_3dc2416c9a7a4c297a19d87fd8edbccc\",\n \"oc_51cd445c9162f2d622f1a984e8bc3f4f\"\n ]\n}\n```\nYou can add the group ID to the `allowFrom` list in the `~/.openclaw/credentials/feishu-default-allowFrom.json` file.\n\n3. Restart the OpenClaw Gateway service again:\n```bash\nsystemctl --user restart openclaw-gateway\n```\nThis will apply the changes to the credentials file and restart the service.\n\nTo verify the fix, you can check the following:\n\n* Run the following command to check",
"metrics": {
"length": 921,
"commands": 3,
"command_list": [
"systemctl --user restart openclaw-gateway",
"You can add the group ID to the `allowFrom` list in the `~/.openclaw/credentials/feishu-default-allowFrom.json` file.",
"3. Restart the OpenClaw Gateway service again:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "OPENCLAW_ERROR_HANDLER — Standard protocol for CLI fatal error external hooks (openclaw-fatal-error-hook-protocol)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the OpenCLAW framework, which is used for testing and validating OpenCL kernels. The error `OPENCLAW_ERROR_HANDLER` is typically raised when there's an issue with the fatal error handler.\n\nTo fix this error, you'll need to create or modify the fatal error handler function. Here's a step-by-step guide to create a custom fatal error handler:\n\n**Step 1: Create a new file for the fatal error handler**\n\nCreate a new file named `fatal_error_handler.claw` in the OpenCLAW installation directory (usually `~/.openclaw/fatal_error_handler.claw` or `C:\\Users\\YourUsername\\.openclaw\\fatal_error_handler.claw`).\n\n**Step 2: Define the fatal error handler function**\n\nIn the `fatal_error_handler.claw` file, define a function that takes two arguments: `error_code` and `error_message`. This function will be called when an error occurs.\n\nHere's an example implementation:\n```claw\nvoid fatal_error_handler(int error_code, const char* error_message) {\n printf(\"FATAL ERROR: %d - %s\\n\", error_code, error_message);\n // Add additional error handling or logging as needed\n",
"metrics": {
"length": 1107,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 7,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "openclaw prefer cli and policy over direct edit (openclaw-prefer-cli-and-policy-over-direct-edit)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error `openclaw prefer cli and policy over direct edit (openclaw-prefer-cli-and-policy-over-direct-edit)`, you can follow these steps:\n\n**Step 1: Remove direct file editing from your configuration**\n\nOpen your `~/.openclaw/config.yaml` file in a text editor and remove any direct file editing lines, such as:\n\n```yaml\nmodel:\n default: gpt-4o-mini\n # TEMP HACK - remove after 2026-07-20, tracked in ISSUE-4321\n```\n\n**Step 2: Use the official CLI to configure your model**\n\nUse the following commands to configure your model using the official CLI:\n\n```bash\nopenclaw config set model.default gpt-4o\nopenclaw config set gateway.timeout 30\n```\n\n**Step 3: Verify your configuration**\n\nUse the following command to verify that your configuration has been set correctly:\n\n```bash\nopenclaw config get model.default\n```\n\nThis should output `gpt-4o`.\n\n**Step 4: Remove temporary hack comments**\n\nIf you have any temporary hack comments in your configuration file, remove them now. For example:\n\n```yaml\nTEMP HACK - remove after 2026-",
"metrics": {
"length": 1036,
"commands": 7,
"command_list": [
"**Step 2: Use the official CLI to configure your model**",
"Use the following commands to configure your model using the official CLI:",
"**Step 3: Verify your configuration**",
"Use the following command to verify that your configuration has been set correctly:",
"This should output `gpt-4o`."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "openclaw gateway dynamic module missing (openclaw-gateway-dynamic-module-missing)",
"condition": "plain",
"status": 200,
"content": "The error \"openclaw gateway dynamic module missing\" typically occurs when the OpenCLAW gateway dynamic module is not properly installed or configured. Here's a step-by-step guide to resolve this issue:\n\n**Prerequisites:**\n\n* OpenCLAW installed on your system\n* Familiarity with Linux command-line interface (CLI)\n\n**Fix:**\n\n1. **Update OpenCLAW package:**\n ```bash\nsudo apt update\nsudo apt upgrade openclaw\n```\n This command updates the OpenCLAW package to the latest version, which may include the necessary dynamic module.\n\n2. **Reinstall OpenCLAW gateway dynamic module:**\n ```bash\nsudo apt install --reinstall openclaw-gateway-dynamic-module\n```\n This command reinstalls the OpenCLAW gateway dynamic module, which may resolve the missing issue.\n\n3. **Check for dependencies:**\n ```bash\nsudo apt install -f\n```\n This command checks for any missing dependencies and installs them.\n\n4. **Verify OpenCLAW installation:**\n ```bash\nopenclaw --version\n```\n This command checks the version of OpenCLAW installed on your system.\n\n5. **Restart OpenCLAW service (if necessary):**\n",
"metrics": {
"length": 1089,
"commands": 5,
"command_list": [
"sudo apt update",
"sudo apt upgrade openclaw",
"sudo apt install --reinstall openclaw-gateway-dynamic-module",
"sudo apt install -f",
"openclaw --version"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 2,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "OpenClaw 重装教训 — 删除前先停服务清残留 (openclaw-reinstall-lesson)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a concrete, actionable fix for the OpenClaw reinstall lesson:\n\n**Step 1: Stop and remove existing services**\n\n```bash\n# Stop the existing service\nsystemctl --user stop openclaw-gateway.service\n\n# Remove any remaining OpenClaw processes\npkill -f openclaw || true\n```\n\n**Step 2: Check for remaining processes**\n\n```bash\n# Check for any remaining OpenClaw processes\nps aux | grep openclaw\n# Expected output: Nothing\n\n# Check for any remaining OpenClaw connections\nss -tlnp | grep -E '18790|3456'\n# Expected output: Nothing\n```\n\n**Step 3: Uninstall global package**\n\n```bash\n# Uninstall the global OpenClaw package\nnpm uninstall -g openclaw\n```\n\n**Step 4: Clean up remaining directories**\n\n```bash\n# Remove any remaining OpenClaw directories\nrm -rf ~/.npm-global/lib/node_modules/openclaw\nrm -rf ~/.config/openclaw\n```\n\n**Step 5: Reinstall OpenClaw**\n\n```bash\n# Reinstall OpenClaw with the global package manager\nnpm install -g openclaw --prefix ~/.npm-global",
"metrics": {
"length": 962,
"commands": 7,
"command_list": [
"systemctl --user stop openclaw-gateway.service",
"pkill -f openclaw || true",
"ps aux | grep openclaw",
"ss -tlnp | grep -E '18790|3456'",
"npm uninstall -g openclaw"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "OpenClaw 重装教训 — 删除前先停服务清残留 (openclaw-reinstall-lesson)",
"condition": "plain",
"status": 200,
"content": "The error \"OpenClaw 重装教训 — 删除前先停服务清残留 (openclaw-reinstall-lesson)\" typically occurs when OpenClaw is unable to remove residual services before reinstalling. Here's a step-by-step guide to resolve this issue:\n\n**Step 1: Stop OpenClaw services**\n\n1. Open the Command Prompt as an administrator:\n - Windows: Press the Windows key + X and select Command Prompt (Admin).\n - macOS: Open Terminal.\n\n2. Stop OpenClaw services:\n ```bash\nsudo service openclaw stop\n```\n\n**Step 2: Remove OpenClaw configuration files**\n\n1. Open the Terminal.\n2. Navigate to the OpenClaw configuration directory:\n ```bash\ncd /usr/local/openclaw/etc\n```\n (Adjust the path according to your OpenClaw installation location.)\n\n3. Remove the configuration files:\n ```bash\nsudo rm -rf *\n```\n\n**Step 3: Remove OpenClaw database files**\n\n1. Navigate to the OpenClaw database directory:\n ```bash\ncd /usr/local/openclaw/var\n```\n (Adjust the path according to your OpenClaw installation location.)\n\n2. Remove the database files",
"metrics": {
"length": 1003,
"commands": 4,
"command_list": [
"sudo service openclaw stop",
"cd /usr/local/openclaw/etc",
"sudo rm -rf *",
"cd /usr/local/openclaw/var"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 7,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "openclaw prefer cli and policy over direct edit (openclaw-prefer-cli-and-policy-over-direct-edit)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the OpenCLAW configuration. The error message indicates that OpenCLAW is set to prefer CLI and policy over direct edit. To resolve this issue, you'll need to modify the OpenCLAW configuration to allow direct edit.\n\nHere's a step-by-step guide to fix the issue:\n\n**For Windows users:**\n\n1. Open the Command Prompt as an administrator.\n2. Navigate to the OpenCLAW installation directory using the following command:\n ```bash\ncd C:\\Program Files\\OpenCLAW\n```\n Replace `C:\\Program Files\\OpenCLAW` with the actual path to the OpenCLAW installation directory on your system.\n\n3. Run the following command to edit the OpenCLAW configuration file:\n ```bash\nnotepad C:\\Program Files\\OpenCLAW\\config.xml\n```\n This will open the `config.xml` file in Notepad.\n\n4. Locate the following line in the `config.xml` file:\n ```xml\n\n```\n If this line exists, delete it. If it doesn't exist, add it with the following content:\n ```xml\n<",
"metrics": {
"length": 1054,
"commands": 3,
"command_list": [
"cd C:\\Program Files\\OpenCLAW",
"notepad C:\\Program Files\\OpenCLAW\\config.xml",
"If this line exists, delete it. If it doesn't exist, add it with the following content:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Permission Denied / WSL NTFS 跨文件系统PermissionFix (permission-denied-fix)",
"condition": "plain",
"status": 200,
"content": "The \"Permission Denied\" error in WSL (Windows Subsystem for Linux) when trying to access an NTFS file system is often caused by the lack of permission to read or write files on the NTFS partition. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Enable WSL File System Access**\n\n1. Open a PowerShell or Command Prompt window on your Windows 10 or Windows 11 machine.\n2. Run the following command to enable WSL file system access:\n ```powershell\nwsl --set-default-version 2\n```\n or\n ```bash\nwsl --set-default-version 2\n```\n This will enable WSL 2, which supports file system access.\n\n**Step 2: Update the WSL File System**\n\n1. Run the following command to update the WSL file system:\n ```powershell\nwsl --update\n```\n or\n ```bash\nwsl --update\n```\n This will update the WSL file system to support file system access.\n\n**Step 3: Mount the NTFS Partition**\n\n1. Identify the NTFS partition you want to access. You can do this by running the following command:\n ```powershell\nw",
"metrics": {
"length": 1005,
"commands": 8,
"command_list": [
"or",
"This will enable WSL 2, which supports file system access.",
"**Step 2: Update the WSL File System**",
"1. Run the following command to update the WSL file system:",
"or"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Permission Denied / WSL NTFS 跨文件系统PermissionFix (permission-denied-fix)",
"condition": "with_lesson",
"status": 200,
"content": "解决 WSL NTFS 跨文件系统 Permission Denied 错误的步骤如下:\n\n**步骤 1: 在 WSL 内部执行 permission_denied_fix 命令**\n\n```bash\nsudo cat /etc/wsl.conf << 'EOF'\n[automount]\nenabled = true\noptions = \"metadata,umask=22\"\nEOF\n```\n\n**步骤 2: 重启 WSL**\n\n```bash\nwsl --shutdown\n```\n\n**步骤 3: 改变所有权**\n\n```bash\nsudo chown -R $(id -u):$(id -g) ~/.hermes/\n```\n\n或者,增加所有用户的写入权限:\n\n```bash\nchmod -R u+w ~/.hermes/\n```\n\n如果是单个文件,则可以使用:\n\n```bash\nchmod u+w ~/.hermes/some_file\n```\n\n**步骤 4: 检查当前用户权限**\n\n```bash\nid\nls -la ~/.hermes/\nstat ~/.hermes/some_file\n```\n\n**步骤 5: 验证 fix 命令**\n\n```bash\nsudo cat /etc/wsl.conf << 'EOF'\necho \"Verification passed:",
"metrics": {
"length": 599,
"commands": 12,
"command_list": [
"sudo cat /etc/wsl.conf << 'EOF'",
"[automount]",
"enabled = true",
"options = \"metadata,umask=22\"",
"EOF"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 12,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "pip install Network Timeout / SSL ErrorFix (pip-install-timeout-ssl)",
"condition": "plain",
"status": 200,
"content": "The error you're experiencing is likely due to the fact that `pip-install-timeout-ssl` is not a valid package. \n\nInstead, you can use `pip install --upgrade pip` and then `pip install requests` and `pip install urllib3` to install the required packages.\n\nHere are the exact commands:\n\n```bash\n# Update pip\npython -m pip install --upgrade pip\n\n# Install requests and urllib3\npython -m pip install requests\npython -m pip install urllib3\n```\n\nIf you still encounter issues with SSL certificates, you can try the following:\n\n```bash\n# Install the certifi package\npython -m pip install certifi\n\n# Install the ca-certificate package\npython -m pip install ca-certificate\n```\n\nAfter installing these packages, try running your original command:\n\n```bash\npip install Network Timeout / SSL ErrorFix\n```\n\nIf you're still experiencing issues, it's possible that the package you're trying to install doesn't exist or is not compatible with your Python version.",
"metrics": {
"length": 947,
"commands": 6,
"command_list": [
"python -m pip install --upgrade pip",
"python -m pip install requests",
"python -m pip install urllib3",
"python -m pip install certifi",
"python -m pip install ca-certificate"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "pip install Network Timeout / SSL ErrorFix (pip-install-timeout-ssl)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a concrete, actionable fix for the pip install error:\n\n**Step 1: Update pip and install the latest version of certifi**\n\nOpen a terminal or command prompt and run the following commands:\n\n```bash\npython -m pip install --upgrade pip\npython -m pip install certifi\n```\n\n**Step 2: Set the global index URL to a fast and reliable mirror**\n\nSet the global index URL to a fast and reliable mirror, such as the one provided by Tsinghua University:\n\n```bash\npip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple\n```\n\n**Step 3: Verify the current configuration**\n\nRun the following command to verify the current configuration:\n\n```bash\npip config list\n```\n\nThis should output something like:\n\n```\nglobal.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'\n```\n\n**Step 4: Install the package**\n\nNow you can install the package using pip:\n\n```bash\npip install \n```\n\nReplace `` with the name of the package you want to install.\n\nIf you encounter any issues during installation, you can try specifying a temporary index URL and increasing the timeout:\n\n```bash\npip install --default",
"metrics": {
"length": 1123,
"commands": 6,
"command_list": [
"python -m pip install --upgrade pip",
"python -m pip install certifi",
"pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple",
"pip config list",
"global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 11,
"lesson_hits": 4,
"lesson_hit_rate": 0.8
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Playwright 在受限容器/sandbox 启动 snap chromium:用 chrome-headless-shell + LD_LIBRARY_PATH 绕开 snap-confine (playwright-snap-chromium-libnss3-sandbox-launch)",
"condition": "with_lesson",
"status": 200,
"content": "为了解决这个问题,我们需要使用 Playwright 缓存里的 `chrome-headless-shell`二进制,指定 `executablePath`,并注入 `LD_LIBRARY_PATH`。下面是具体的命令和步骤:\n\n1. 通过 Playwright 缓存里的 `chrome-headless-shell`二进制找到路径:\n ```javascript\nconst fs = require('node:fs');\nconst path = require('node:path');\n\nconst cacheRoot = path.join(\n process.env.HOME || '/root',\n '.cache/ms-playwright'\n);\nconst dirs = fs.readdirSync(cacheRoot)\n .filter(d => d.startsWith('chromium_headless_shell-'));\nconst shellPath = path.join(\n cacheRoot,\n dirs[0],\n 'chrome-linux/headless_shell'\n);\n```\n2. 使用 `executablePath` 指定 `chrome-headless-shell`二进制的路径:\n ```javascript\nconst browser = await playwright.chromium.launch({\n executablePath: shellPath,\n headless: true,\n args: [\n '--no-sandbox',\n '--disable-setuid-sandbox',\n '--disable-dev-shm-usage',\n '--disable-features=libnss3',\n '--disable-",
"metrics": {
"length": 846,
"commands": 1,
"command_list": [
"2. 使用 `executablePath` 指定 `chrome-headless-shell`二进制的路径:"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 8,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "PR Genius issue evaluator: batch review intake issues (pr-genius-issue-evaluator-for-intake)",
"condition": "with_lesson",
"status": 200,
"content": "To resolve the PR Genius issue evaluator: batch review intake issues, you can follow these steps:\n\n1. First, update your GitHub repository to use the latest version of PR Genius. You can do this by running the following command in your terminal:\n\n ```bash\nprgenius update --repo Ikalus1988/MisakaNet\n```\n\n2. Next, evaluate all intake issues in batch mode using the following command:\n\n ```bash\nprgenius issue-batch --repo Ikalus1988/MisakaNet --label intake --limit 20\n```\n\n This command will evaluate the intake issues in batches of 20, providing you with a score (0-100), tier (low_risk / medium_risk / high_risk), quality_grade (A-F), is_spam, is_crawler_friendly, signals (positive/negative), and checklist (actionable items) for each issue.\n\n3. After running the `prgenius issue-batch` command, you can verify that the output is correct by checking the lessons file. Run the following command in your terminal:\n\n ```bash\ngrep -i mcp lessons/contrib/mcp-.md 2/dev/null | head -3\necho MCP verified\n``",
"metrics": {
"length": 1011,
"commands": 2,
"command_list": [
"prgenius update --repo Ikalus1988/MisakaNet",
"prgenius issue-batch --repo Ikalus1988/MisakaNet --label intake --limit 20"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Playwright 在受限容器/sandbox 启动 snap chromium:用 chrome-headless-shell + LD_LIBRARY_PATH 绕开 snap-confine (playwright-snap-chromium-libnss3-sandbox-launch)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to a limitation in the Playwright snap package for Chromium. To resolve this issue, you can try the following steps:\n\n**Method 1: Using `--no-sandbox` flag**\n\nYou can try running Playwright with the `--no-sandbox` flag, which will disable the sandboxing feature:\n\n```bash\nplaywright --no-sandbox launch --headless --chromium\n```\n\n**Method 2: Setting `LD_LIBRARY_PATH` environment variable**\n\nYou can also try setting the `LD_LIBRARY_PATH` environment variable to bypass the `snap-confine` issue:\n\n```bash\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libnss3.so\nplaywright launch --headless --chromium\n```\n\n**Method 3: Using `--disable-sandbox` flag (for Chromium 96 and later)**\n\nIf you're using Chromium 96 or later, you can try using the `--disable-sandbox` flag:\n\n```bash\nplaywright --disable-sandbox launch --headless --chromium\n```\n\n**Method 4: Using `--no-sandbox` and `--disable-extensions` flags (for Chromium 96 and later)**\n\n",
"metrics": {
"length": 993,
"commands": 4,
"command_list": [
"playwright --no-sandbox launch --headless --chromium",
"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libnss3.so",
"playwright launch --headless --chromium",
"playwright --disable-sandbox launch --headless --chromium"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 14,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python GBK Encoding Error — Windows/WSL 跨平台 (python-gbk-encoding-error)",
"condition": "with_lesson",
"status": 200,
"content": "Here are the steps to fix the Python GBK Encoding Error in WSL:\n\n### Step 1: Specify encoding when reading and writing files\n\nUpdate your Python script to specify the encoding when reading and writing files:\n```python\n# Read file with UTF-8 encoding\nwith open(\"file.txt\", \"r\", encoding=\"utf-8\") as f:\n content = f.read()\n\n# Write file with UTF-8 encoding\nwith open(\"file.txt\", \"w\", encoding=\"utf-8\") as f:\n f.write(content)\n```\n### Step 2: Set environment variables (recommended for permanent solution)\n\nAdd the following lines to your `~/.bashrc` file to set the environment variables permanently:\n```bash\nexport PYTHONIOENCODING=utf-8\nexport LANG=C.UTF-8\n```\nThen, run the following command to apply the changes:\n```bash\nsource ~/.bashrc\n```\n### Step 3: Update system locale (optional)\n\nIf you want to update the system locale, run the following command:\n```bash\nsudo locale-gen zh_CN.UTF-8\n```\nThis will update the locale to Chinese (Simplified) using the UTF-8 encoding.\n\n### Step 4: Verify the changes\n\n",
"metrics": {
"length": 1014,
"commands": 3,
"command_list": [
"Add the following lines to your `~/.bashrc` file to set the environment variables permanently:",
"Then, run the following command to apply the changes:",
"If you want to update the system locale, run the following command:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "PR Genius issue evaluator: batch review intake issues (pr-genius-issue-evaluator-for-intake)",
"condition": "plain",
"status": 200,
"content": "I can guide you through the process of fixing the PR Genius issue evaluator. \n\nThe error you're experiencing is likely due to missing dependencies or incorrect configuration. Here's a step-by-step solution:\n\n**Step 1: Update the dependencies**\n\nRun the following command to update the dependencies:\n\n```bash\npip install --upgrade -r requirements.txt\n```\n\n**Step 2: Install the required packages**\n\nIf the above command doesn't resolve the issue, you might need to install additional packages. You can try the following:\n\n```bash\npip install pandas\npip install numpy\npip install scikit-learn\n```\n\n**Step 3: Check the configuration**\n\nPR Genius issue evaluator uses a configuration file named `pr_genius_config.py`. Make sure this file is in the correct location and contains the necessary settings.\n\n```python\n# pr_genius_config.py\n# Define your configuration here\nPR_GENIUS_API_KEY = 'YOUR_API_KEY'\nPR_GENIUS_BASE_URL = 'https://api.pr-genius.com'\n```\n\nReplace `'YOUR_API_KEY'` with your actual PR Genius API key.\n\n**Step 4: Check the environment variables**\n\nPR Genius issue evaluator also uses environment variables. Make sure the following variables are set:\n\n```bash\n",
"metrics": {
"length": 1171,
"commands": 7,
"command_list": [
"pip install --upgrade -r requirements.txt",
"pip install pandas",
"pip install numpy",
"pip install scikit-learn",
"Replace `'YOUR_API_KEY'` with your actual PR Genius API key."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python GBK Encoding Error — Windows/WSL 跨平台 (python-gbk-encoding-error)",
"condition": "plain",
"status": 200,
"content": "The GBK encoding error in Python typically occurs when you're trying to read or write files using the GBK encoding on a system that doesn't support it. Here's a concrete, actionable fix:\n\n**Method 1: Install the `gbk` encoding package**\n\nYou can install the `gbk` encoding package using pip, which is Python's package manager. Open a terminal or command prompt and run the following command:\n\n```bash\nsudo apt-get update\nsudo apt-get install python3-gbk\n```\n\n**Method 2: Use the `chardet` library to detect the encoding**\n\nIf the above method doesn't work, you can try using the `chardet` library to detect the encoding of your files. First, install the `chardet` library using pip:\n\n```bash\npip3 install chardet\n```\n\nThen, use the following code to detect the encoding of a file:\n\n```python\nimport chardet\n\nwith open('your_file.txt', 'rb') as f:\n result = chardet.detect(f.read())\n print(result)\n```\n\nReplace `'your_file.txt'` with the path to your file.\n\n**Method 3: Use the `codecs` module to specify the encoding",
"metrics": {
"length": 1022,
"commands": 3,
"command_list": [
"sudo apt-get update",
"sudo apt-get install python3-gbk",
"pip3 install chardet"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 12,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python 沙箱/受限环境 — PATH 和 sys.path 隔离 (python-sandbox-path-isolation)",
"condition": "with_lesson",
"status": 200,
"content": "为了解决 Python 沙箱/受限环境 — PATH 和 sys.path 隔离问题,我们需要遵循以下步骤:\n\n1. 确认是否在正确的 venv 中\n2. 强制指定解释器(在 shell 中)\n3. 在沙箱中临时添加路径\n4. 检查 PATH(子进程会继承)\n5. 验证 import 来源\n\n下面是具体的命令和示例:\n\n**步骤 1: 确认是否在正确的 venv 中**\n\n```bash\n# 切换到正确的 venv\ncd /path/to/your/venv\n\n# 确认是否在正确的 venv 中\npython3 --version\npython3 -c 'import sys; print(sys.version)'\n```\n\n**步骤 2: 强制指定解释器(在 shell 中)**\n\n```bash\n# 指定解释器\n/path/to/venv/bin/python script.py\n```\n\n**步骤 3: 在沙箱中临时添加路径**\n\n```python\n# 在 Python 中临时添加路径\nimport sys\nimport os\n\nsys.path.insert(0, \"/path",
"metrics": {
"length": 502,
"commands": 4,
"command_list": [
"cd /path/to/your/venv",
"python3 --version",
"python3 -c 'import sys; print(sys.version)'",
"/path/to/venv/bin/python script.py"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 4,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python 代码修改不生效 — stale .pyc Cache (python-pycache-stale)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to a stale `.pyc` cache file. Here's a step-by-step solution to resolve this issue:\n\n**Method 1: Delete the stale `.pyc` cache manually**\n\n1. Locate the directory where your Python scripts are located. This is usually `C:\\Users\\YourUsername\\AppData\\Local\\Python\\Python3.x\\site-packages` (Windows) or `~/.local/lib/pythonX.X/site-packages/` (Linux/Mac).\n2. Open a command prompt or terminal.\n3. Navigate to the directory where you found in step 1 using the `cd` command. For example:\n - Windows: `cd C:\\Users\\YourUsername\\AppData\\Local\\Python\\Python3.x\\site-packages`\n - Linux/Mac: `cd ~/.local/lib/pythonX.X/site-packages/`\n4. Delete all the `.pyc` files in the directory using the `rm` command. For example:\n - Windows: `rm *.pyc`\n - Linux/Mac: `rm *.pyc`\n\n**Method 2: Use pip to delete the stale cache**\n\n1. Open a command prompt or terminal.\n2. Navigate to the directory where your Python scripts are located.\n3",
"metrics": {
"length": 959,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 10,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python 代码修改不生效 — stale .pyc Cache (python-pycache-stale)",
"condition": "with_lesson",
"status": 200,
"content": "以下是具体的步骤来解决这个问题:\n\n**步骤 1:删除当前项目下所有 __pycache__ 目录**\n\n```bash\nfind . -type d -name __pycache__ -exec rm -rf {} +\n```\n\n**步骤 2: 同时删除散落的 .pyc 文件**\n\n```bash\nfind . -name \".pyc\" -delete\n```\n\n**步骤 3:针对单个模块清理**\n\n```bash\nrm -rf path/to/module/__pycache__\n```\n\n**步骤 4: 使用环境变量禁止 Python 写入字节码缓存**\n\n```bash\nexport PYTHONDONTWRITEBYTECODE=1\npython your_script.py\n```\n\n**步骤 5: 强制 Python 重新编译所有模块**\n\n```bash\npython -m compileall .\n```\n\n**步骤 6: 查看某个模块实际加载的是源码还是缓存**\n\n```bash\npython -c \"import your_module; import inspect; print(inspect.getfile(your_module))\"\n```\n\n**快速验证改动是否生效**\n\n在脚本顶部临时添加:\n\n",
"metrics": {
"length": 575,
"commands": 7,
"command_list": [
"find . -type d -name __pycache__ -exec rm -rf {} +",
"find . -name \".pyc\" -delete",
"rm -rf path/to/module/__pycache__",
"export PYTHONDONTWRITEBYTECODE=1",
"python your_script.py"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 11,
"lesson_hits": 5,
"lesson_hit_rate": 0.833
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Fix Python Smtplib SSL Certificate Verify Failed Error When Sending Emails (python-smtplib-ssl-certificate-verify-failed-fix)",
"condition": "with_lesson",
"status": 200,
"content": "Fix Python Smtplib SSL Certificate Verify Failed Error When Sending Emails\n\n**Решение:**\n\nЧтобы решить проблему SSL Certificate Verify Failed при отправке электронных писем через SMTP-сервер Gmail, вы можете использовать следующее решение:\n\n### 1. Добавление локальных корневых сертификатов (CA Certificates)\n\nЕсли вы используете чистый Python на Windows или macOS, вы можете добавить локальные корневые сертификаты (CA Certificates) к Python.\n\n**Для Windows:**\n\n1. Скачайте и установите OpenSSL:\n ```bash\nwinget install --exact-match python\n```\n2. Добавьте локальные корневые сертификаты (CA Certificates) к Python:\n ```bash\npython -m ssl.match_hostname -k\n```\n\n**Для macOS/Linux:**\n\n1. Установите OpenSSL:\n ```bash\nsudo apt-get install openssl\n```\n2. Добавьте локальные корневые сертификаты (CA Certificates) к Python:\n ```bash\nsudo python -m ssl.match_hostname -k\n```\n\n### 2. Использование ssl.create_default_context() с параметром verify=False\n\nЕсли",
"metrics": {
"length": 961,
"commands": 4,
"command_list": [
"winget install --exact-match python",
"python -m ssl.match_hostname -k",
"sudo apt-get install openssl",
"sudo python -m ssl.match_hostname -k"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python 沙箱/受限环境 — PATH 和 sys.path 隔离 (python-sandbox-path-isolation)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to Python's sandboxing and path isolation. This issue can be resolved by modifying the `sys.path` and `PATH` environment variables in your Python environment.\n\nHere's a step-by-step solution:\n\n**For Linux and macOS:**\n\n1. Create a new file named `~/.pythonprofile` (for Linux and macOS) or `~/.python` (for macOS) with the following content:\n\n```python\nimport sys\nsys.path.insert(0, '/path/to/your/project')\n```\n\nReplace `/path/to/your/project` with the actual path to your project.\n\n2. Run the following command to apply the changes:\n\n```bash\npython -m site --user-site ~/.pythonprofile\n```\n\nor\n\n```bash\npython -m site --user-site ~/.python\n```\n\n**For Windows:**\n\n1. Create a new file named `C:\\Users\\YourUsername\\.python` (replace `YourUsername` with your actual username) with the following content:\n\n```python\nimport sys\nsys.path.insert(0, 'C:\\\\path\\\\to\\\\your\\\\project')\n```\n\nReplace `C:\\path\\to\\your\\project` with the actual path to your project.\n\n2. Run the",
"metrics": {
"length": 1004,
"commands": 5,
"command_list": [
"Replace `/path/to/your/project` with the actual path to your project.",
"2. Run the following command to apply the changes:",
"or",
"**For Windows:**",
"1. Create a new file named `C:\\Users\\YourUsername\\.python` (replace `YourUsername` with your actual username) with the following content:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 15,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python venv 中 tiktoken 安装后仍报 ModuleNotFoundError (python-venv-tiktoken-module-not-found)",
"condition": "with_lesson",
"status": 200,
"content": "解决 Python venv 中 tiktoken 安装后仍报 ModuleNotFoundError 的问题:\n\n1. first,确保pip可用:\n ```bash\n python -m ensurepip\n ```\n\n2. 重新安装setuptools:\n ```bash\n pip install setuptools\n ```\n\n3. 重新安装tiktoken:\n ```bash\n pip install tiktoken\n ```\n\n4. 如果问题 persists,尝试重建venv:\n ```bash\n python -m venv venv --include-pip\n pip install tiktoken\n ```\n\n5. 验证tiktoken的安装:\n ```bash\n python -c \"import tiktoken; enc = tiktoken.get_encoding('cl100k_base'); print(enc.encode('hello'))\"\n ```\n\n6. 在Windows + WSL2混合环境中,建议使用python -m ensurepip初始化venv,以避免这种情况。",
"metrics": {
"length": 574,
"commands": 6,
"command_list": [
"python -m ensurepip",
"pip install setuptools",
"pip install tiktoken",
"python -m venv venv --include-pip",
"pip install tiktoken"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 9,
"lesson_hits": 5,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Fix Python Smtplib SSL Certificate Verify Failed Error When Sending Emails (python-smtplib-ssl-certificate-verify-failed-fix)",
"condition": "plain",
"status": 200,
"content": "**Fixing Python Smtplib SSL Certificate Verify Failed Error**\n\nThe \"SSL Certificate Verify Failed\" error occurs when the Python `smtplib` library is unable to verify the SSL certificate of the SMTP server you're trying to connect to. This can be due to various reasons such as:\n\n* The SMTP server's SSL certificate is not trusted by the system.\n* The system's clock is not synchronized with the SMTP server's clock.\n* The system's SSL/TLS configuration is not properly set up.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Method 1: Update the system's SSL/TLS configuration**\n\nThis method updates the system's SSL/TLS configuration to trust the SMTP server's certificate.\n\n```bash\n# Update the system's SSL/TLS configuration\nsudo apt-get update && sudo apt-get install ca-certificates\n```\n\n**Method 2: Add the SMTP server's certificate to the system's trusted certificates**\n\nThis method adds the SMTP server's certificate to the system's trusted certificates.\n\n```bash\n# Get the SMTP server's certificate\ncurl -s -o /etc/ssl/certs/smtp_server.crt https://smtp.example.com/certificates.crt\n\n# Add the certificate to the system's trusted certificates\nsudo update-ca",
"metrics": {
"length": 1178,
"commands": 1,
"command_list": [
"sudo apt-get update && sudo apt-get install ca-certificates"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python venv 中 tiktoken 安装后仍报 ModuleNotFoundError (python-venv-tiktoken-module-not-found)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is likely due to a version incompatibility between the `python-venv` package and the `tiktoken` library. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Update your Python version**\n\nBefore proceeding, ensure you're using the latest version of Python. You can check your current Python version by running:\n```bash\npython --version\n```\nIf you're using an older version, consider updating to the latest version using your package manager or by downloading the latest version from the official Python website.\n\n**Step 2: Install `python-venv` and `pytorch`**\n\nMake sure you have `python-venv` and `pytorch` installed. If not, you can install them using pip:\n```bash\npip install --upgrade python-venv\npip install torch torchvision\n```\n**Step 3: Install `transformers` and `tokall`**\n\nThe `tiktoken` library is part of the `transformers` package. To install `transformers` and its dependencies, run:\n```bash\npip install transformers\n```\nHowever, the `transformers` package has a dependency on `tokall`, which is not available on PyPI.",
"metrics": {
"length": 1075,
"commands": 4,
"command_list": [
"python --version",
"pip install --upgrade python-venv",
"pip install torch torchvision",
"pip install transformers"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 18,
"lesson_hits": 5,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python venv 激活失败或路径不匹配 (python-venv-troubleshoot)",
"condition": "plain",
"status": 200,
"content": "The error \"激活失败或路径不匹配\" which translates to \"activation failed or path not matched\" in English, is a common issue when trying to activate a Python virtual environment (venv) in Windows.\n\nHere's a step-by-step solution:\n\n**Method 1: Reinstall Python**\n\n1. Uninstall Python from your system (if you haven't already).\n2. Download the latest version of Python from the official Python website: https://www.python.org/downloads/\n3. Run the installer and follow the prompts to install Python.\n4. Once installed, open a new Command Prompt or PowerShell as an administrator.\n5. Navigate to the directory where you installed Python (e.g., `C:\\Python39`).\n6. Run the following command to activate the venv:\n ```bash\npython -m venv --upgrade\n```\n7. Activate the venv:\n ```bash\n.\\Scripts\\activate\n```\n (on Windows)\n\n**Method 2: Fix the PATH Environment Variable**\n\n1. Open the System Properties window:\n - Right-click on \"Computer\" or \"This PC\" and select \"Properties\".\n - Click on \"Advanced system settings\" on the left side.\n - Click on \"Environment Variables\".\n",
"metrics": {
"length": 1063,
"commands": 2,
"command_list": [
"python -m venv --upgrade",
".\\Scripts\\activate"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 4,
"lesson_hits": 2,
"lesson_hit_rate": 0.333
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Python venv 激活失败或路径不匹配 (python-venv-troubleshoot)",
"condition": "with_lesson",
"status": 200,
"content": "Here's a step-by-step guide to fixing the \"Python venv 激活失败或路径不匹配\" error:\n\n**Step 1: Determine your shell type**\n\nRun the following command to determine your shell type:\n```bash\necho $SHELL\n```\nThis will output `bash` or `zsh`.\n\n**Step 2: Verify the `venv` directory**\n\nRun the following command to verify the `venv` directory:\n```bash\nwhich python\npython -c \"import sys; print(sys.prefix)\"\n```\nIf the output is not `venv`, run `source venv/bin/activate` or `source .venv/bin/activate` to activate the `venv` directory.\n\n**Step 3: Remove the `venv` directory (if it exists)**\n\nIf you created multiple `venv` directories, remove the existing one:\n```bash\nrm -rf venv\n```\n**Step 4: Re-create the `venv` directory**\n\nRe-create the `venv` directory:\n```bash\npython3 -m venv venv\n```\n**Step 5: Activate the `venv` directory**\n\nActivate the `venv` directory:\n```bash\nsource v",
"metrics": {
"length": 869,
"commands": 5,
"command_list": [
"echo $SHELL",
"which python",
"python -c \"import sys; print(sys.prefix)\"",
"rm -rf venv",
"python3 -m venv venv"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 22,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Alarm Code Retrieval Needs Mandatory Keyword Recall (rag-alarm-code-mandatory-recall)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the RAG Alarm Code Retrieval Needs Mandatory Keyword Recall error, you'll need to modify the `retrieve()` function in `rag_core.py`. Here's a step-by-step guide:\n\n**Step 1: Identify the problematic code**\n\nOpen the `rag_core.py` file and search for the `retrieve()` function. Look for the lines that handle the alarm code pattern and robot model matching.\n\n**Step 2: Modify the `retrieve()` function**\n\nAdd the following code to the `retrieve()` function to implement keyword mandatory recall:\n```python\ndef retrieve(self, query, context):\n # ... (existing code)\n \n # Alarm code pattern: when /[A-Z]+-\\d+/ matches, forcibly recall documents whose titles/tags contain that code\n alarm_code_pattern = r\"[A-Z]+-\\d+\"\n if re.search(alarm_code_pattern, query):\n # Recall documents whose titles/tags contain the alarm code\n alarm_code = query[query.index(alarm_code_pattern) + len(alarm_code_pattern):]\n self._recall_documents(context, alarm_code, force=True)\n \n # Robot model matching: match model names as strings and merge them into the retrieval results\n robot_model_pattern = r\"M-\\d+|",
"metrics": {
"length": 1134,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 6,
"lesson_hits": 3,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Alarm Code Retrieval Needs Mandatory Keyword Recall (rag-alarm-code-mandatory-recall)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is a known issue with the RAG (Risk and Alert Group) system. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Ensure you have administrative privileges on the system.\n2. Familiarize yourself with the RAG system configuration and settings.\n\n**Fix:**\n\n1. **Check the RAG system configuration:**\n - Log in to the RAG system as an administrator.\n - Navigate to the \"System Settings\" or \"Configuration\" section.\n - Look for the \"Alarm Code Retrieval\" or \"RAG Alarm Code Retrieval\" setting.\n - Verify that the \"Mandatory Keyword Recall\" option is enabled.\n\n2. **Verify the keyword list:**\n - If the \"Mandatory Keyword Recall\" option is enabled, check if the keyword list is complete and up-to-date.\n - Ensure that all required keywords are included in the list.\n\n3. **Update the keyword list:**\n - If the keyword list is incomplete or outdated, update it by adding or removing keywords as necessary.\n - Save the changes to the keyword list.\n\n4. **Disable the \"Mandatory Keyword Recall\" option (if applicable):**\n - If the issue persists,",
"metrics": {
"length": 1104,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 0,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG 知识库品牌污染Detection与治理 (rag-brand-contamination-detection-and-fix)",
"condition": "with_lesson",
"status": 200,
"content": "以下是解决 RAG 知识库品牌污染的具体操作:\n\n**步骤 1: 全量元数据打标**\n\n```bash\n# 确保 ChromaDB 的数据库连接\npython\nimport chromadb\nfrom chromadb import collection\n\n# 连接到 ChromaDB\ndb = chromadb.connect('your_database_name')\n\n# 获取 chunk IDs 和 元数据\nids = db.collection('your_collection_name').chunk_ids()\nmetadatas = db.collection('your_collection_name').chunk_metadata()\n\n# 分批打标\nbatch_size = 100\nfor i in range(0, len(ids), batch_size):\n chunk_ids = ids[i:i+batch_size]\n chunk_metadatas = metadatas[i:i+batch_size]\n \n # 打标\n for doc_id, meta in zip(chunk_ids, chunk_metadatas):\n fn = meta.get(\"filename\", \"\")\n if kuka_pat.search(fn): brand = \"kuka\"\n elif abb_pat.search(fn): brand = \"abb\"\n elif fanuc_pat.search(fn): brand = \"fanuc\"\n else: brand = \"unknown\"\n collection.update(ids=[doc_id], metadatas=[",
"metrics": {
"length": 855,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": false,
"inline_code_count": 0,
"lesson_hits": 6,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG 知识库品牌污染Detection与治理 (rag-brand-contamination-detection-and-fix)",
"condition": "plain",
"status": 200,
"content": "The error message \"RAG 知识库品牌污染Detection与治理\" is not a standard error message and seems to be a Chinese error message. However, I'll assume that it's related to a Rust or Go programming language issue.\n\nSince I don't have more information about the error, I'll provide a general solution for a common error in Rust and Go programming languages.\n\n**Rust Error Fix:**\n\nIf you're experiencing issues with a Rust project, here's a general fix:\n\n1. Update the Rust version:\n ```bash\nrustup update\n```\n2. Clean the project:\n ```bash\ncargo clean\n```\n3. Rebuild the project:\n ```bash\ncargo build\n```\n4. Check for dependencies:\n ```bash\ncargo check\n```\n\n**Go Error Fix:**\n\nIf you're experiencing issues with a Go project, here's a general fix:\n\n1. Update the Go version:\n ```bash\ngo get golang.org/x/tools/cmd/goimports\ngo mod tidy\ngo mod clean\ngo mod vendor\ngo get golang.org/x/tools/cmd/goimports\n```\n Or \n ```bash\ngo mod tidy\ngo mod clean\ngo mod vendor\ngo get golang",
"metrics": {
"length": 972,
"commands": 9,
"command_list": [
"rustup update",
"cargo clean",
"cargo build",
"cargo check",
"go get golang.org/x/tools/cmd/goimports"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 10,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Chinese Encoding with PyMuPDF (rag-chinese-encoding-pymupdf)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to PyMuPDF not supporting the RAG Chinese encoding. Here's a concrete, actionable fix with exact commands:\n\n**Method 1: Install a custom encoding**\n\nYou can install a custom encoding using pip:\n\n```bash\npip install pymupdf[rag-chinese-encoding]\n```\n\n**Method 2: Use a different library**\n\nIf the above method doesn't work, you can try using a different library that supports RAG Chinese encoding. One alternative is `pdfquery`:\n\n```bash\npip install pdfquery\n```\n\nThen, you can use the following code to extract text from a PDF file with RAG Chinese encoding:\n\n```python\nimport pdfquery\n\nwith open('example.pdf', 'rb') as f:\n pdf = pdfquery.PDFQuery(f)\n text = pdf.text()\n print(text)\n```\n\n**Method 3: Convert the PDF to a different encoding**\n\nIf the above methods don't work, you can try converting the PDF to a different encoding. You can use the following code to convert the PDF to UTF-8:\n\n```python\nimport fitz\n\ndoc = fitz.open('example.pdf')\nfor page in doc:\n page.text = page.text.decode('utf-",
"metrics": {
"length": 1049,
"commands": 4,
"command_list": [
"pip install pymupdf[rag-chinese-encoding]",
"pip install pdfquery",
"**Method 3: Convert the PDF to a different encoding**",
"If the above methods don't work, you can try converting the PDF to a different encoding. You can use the following code to convert the PDF to UTF-8:"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 1,
"lesson_hit_rate": 0.2
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Chinese Encoding with PyMuPDF (rag-chinese-encoding-pymupdf)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the issue with pymupdf4llm extracting PDFs with Chinese special characters being truncated due to the default encoding, you can explicitly specify the encoding to UTF-8 in the extract() call.\n\nHere's the corrected Python code:\n\n```python\nimport pymupdf4llm\n\n# Load the PDF document\ndoc = pymupdf4llm.load(\"path_to_your_pdf_file.pdf\")\n\n# Extract the text from the PDF document with UTF-8 encoding\ntext = pymupdf4llm.extract(doc, encoding=\"utf-8\")\n\n# Print the extracted text\nprint(text)\n```\n\nReplace `\"path_to_your_pdf_file.pdf\"` with the actual path to the PDF file you want to extract text from.\n\nIf you're using a Python script to automate this process, make sure to add the encoding specification in the extract() call.\n\nExample:\n\n```python\nimport pymupdf4llm\n\n# Load the PDF document\ndoc = pymupdf4llm.load(\"path_to_your_pdf_file.pdf\")\n\n# Extract the text from the PDF document with UTF-8 encoding\ntext = pymupdf4llm.extract(doc, encoding=\"utf-8\")\n\n# Save the extracted text to a file\nwith open(\"",
"metrics": {
"length": 1007,
"commands": 3,
"command_list": [
"Replace `\"path_to_your_pdf_file.pdf\"` with the actual path to the PDF file you want to extract text from.",
"If you're using a Python script to automate this process, make sure to add the encoding specification in the extract() call.",
"Example:"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 3,
"lesson_hits": 4,
"lesson_hit_rate": 0.8
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Chunk Parameters 800 Characters and 100 Overlap (rag-chunk-params-800-100)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to adjust the chunking strategy in your RAG configuration. Here's a step-by-step guide with exact commands:\n\n1. **Update the RAG configuration**:\n\n First, update the RAG configuration to use the new chunking parameters.\n\n ```python\nfrom rag import RAG\nfrom rag.utils import RecursiveCharacterTextSplitter\n\n# Initialize RAG with the updated configuration\nrag = RAG(\n config={\n \"chunking\": {\n \"chunk_size\": 800, # About 800 characters per chunk\n \"chunk_overlap\": 100, # 100-character overlap between chunks\n \"length_function\": len,\n \"separators\": [\"\\n\\n\", \"\\n\", \"。\", \"!\", \"?\", \" \", \"\"]\n },\n # Other configurations...\n }\n)\n```\n\n2. **Verify the configuration**:\n\n To verify that the configuration has been updated correctly, you can check the ingestion log.\n\n ```bash\n# Get the ingestion log\ningestion_log = rag.ingestion_log\n\n# Check if the chunking parameters have been updated\nprint(ingestion_log.get(\"chunking\"))\n```\n\n The output should match the new chunking",
"metrics": {
"length": 1069,
"commands": 2,
"command_list": [
"2. **Verify the configuration**:",
"To verify that the configuration has been updated correctly, you can check the ingestion log."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 4,
"lesson_hit_rate": 0.667
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Chunk Parameters 800 Characters and 100 Overlap (rag-chunk-params-800-100)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the size of your RAG (Rapid Autocomplete Grammar) chunk parameters. The error message indicates that the chunk parameters are too large (800 characters) and the overlap is too high (100).\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Reduce the chunk size**\n\nYou can reduce the chunk size by changing the value in the `rag-chunk-size` configuration option. Here's an example command:\n\n```bash\ndotnet build -c Release --configuration Release --arg \"rag-chunk-size=600\"\n```\n\nIn this command, we're changing the chunk size to 600 characters.\n\n**Step 2: Reduce the overlap**\n\nYou can also reduce the overlap by changing the value in the `rag-chunk-overlap` configuration option. Here's an example command:\n\n```bash\ndotnet build -c Release --configuration Release --arg \"rag-chunk-overlap=50\"\n```\n\nIn this command, we're changing the overlap to 50 characters.\n\n**Step 3: Rebuild the project**\n\nAfter making these changes, you'll need to rebuild your project to apply the new configuration options. You can do this using the following command:\n\n```bash\ndotnet build",
"metrics": {
"length": 1121,
"commands": 2,
"command_list": [
"dotnet build -c Release --configuration Release --arg \"rag-chunk-size=600\"",
"dotnet build -c Release --configuration Release --arg \"rag-chunk-overlap=50\""
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 6,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cross-encoder reranker kills RAG latency on CPU-only machines (rag-cross-encoder-cpu-bottleneck)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the \"Cross-encoder reranker kills RAG latency on CPU-only machines\" error, you can try the following concrete, actionable steps:\n\n**Step 1: Disable Cross-encoder Reranking**\n\nYou can disable cross-encoder reranking by adding the following configuration to your model configuration file (e.g., `config.json` or `model_config.py`):\n\n```json\n{\n \"model\": {\n \"name\": \"bge-reranker-v2-m3\",\n \"config\": {\n \"disable_cross_encoder_reranking\": true\n }\n }\n}\n```\n\nor\n\n```python\nimport json\n\nmodel_config = {\n \"model\": {\n \"name\": \"bge-reranker-v2-m3\",\n \"config\": {\n \"disable_cross_encoder_reranking\": True\n }\n }\n}\n\nwith open('config.json', 'w') as f:\n json.dump(model_config, f, indent=4)\n```\n\n**Step 2: Update the Model Configuration File**\n\nAfter making the change, update the model configuration file to include the new configuration.\n\n**Step 3: Re-run Your Model**\n\nRe-run your model with the updated configuration to see if it improves performance.\n\nNote:",
"metrics": {
"length": 1010,
"commands": 1,
"command_list": [
"or"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 2,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "Cross-encoder reranker kills RAG latency on CPU-only machines (rag-cross-encoder-cpu-bottleneck)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is related to the performance of the Cross-Encoder Reranker model on CPU-only machines. This issue is known as the \"rag-cross-encoder-cpu-bottleneck.\" Here's a concrete, actionable fix with exact commands:\n\n**Fix 1: Increase the number of CPU cores**\n\nThe Cross-Encoder Reranker model relies heavily on the number of CPU cores available. Increasing the number of cores can significantly improve performance. You can do this by:\n\n* Adding more CPU cores to your machine (if possible)\n* Using a cloud service with more CPU cores (e.g., AWS EC2, Google Cloud Compute Engine)\n\nAlternatively, you can use a distributed computing framework like [Dask](https://dask.org/) to utilize multiple CPU cores.\n\n**Fix 2: Use a GPU-accelerated model**\n\nThe Cross-Encoder Reranker model can be accelerated using a GPU. You can do this by:\n\n* Installing a GPU-accelerated deep learning framework like [TensorFlow](https://www.tensorflow.org/), [PyTorch](https://pytorch.org/), or [Hugging Face Transformers](https://huggingface.co/models)\n* Migrating your model to a",
"metrics": {
"length": 1086,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 0,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG 检索六层静默退化:BM25 失败 + 截断 + 分数混合导致有效 chunk 被丢弃 (rag-retrieval-six-layer-silent-degradation)",
"condition": "with_lesson",
"status": 200,
"content": "为了解决 RAG 检索六层静默退化:BM25 失败 + 截断 + 分数混合导致有效 chunk 被丢弃(rag-retrieval-six-layer-silent-degradation)的问题,我们需要进行以下修复:\n\n**步骤 1:验证 BM25 索引完整性**\n\n```bash\npython3 scripts/misakanet_cli.py doctor\n```\n\n**步骤 2:添加 warmup 重试逻辑**\n\n```bash\n# 在 misakanet_cli.py 中添加 warmup 重试逻辑\nif __name__ == \"__main__\":\n # ... existing code ...\n if not query_result:\n # 等待 5s 重试\n time.sleep(5)\n if not query_result:\n # 重试失败后回退到 BM25-only\n query_result = run_bm25_query(query)\n # ... existing code ...\n```\n\n**步骤 3:修复 $contains tokenization**\n\n```bash\n# 在 misakanet_cli.py 中添加统一查询预处理\ndef preprocess_query(query):\n # 分词\n tokens = tokenizer.tokenize(query)\n # 匹配\n matched_tokens = [token",
"metrics": {
"length": 713,
"commands": 6,
"command_list": [
"python3 scripts/misakanet_cli.py doctor",
"if __name__ == \"__main__\":",
"if not query_result:",
"time.sleep(5)",
"if not query_result:"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 4,
"lesson_hits": 3,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG 检索六层静默退化:BM25 失败 + 截断 + 分数混合导致有效 chunk 被丢弃 (rag-retrieval-six-layer-silent-degradation)",
"condition": "plain",
"status": 200,
"content": "The error message you're encountering suggests that the RAG (Ranking Algorithm Group) is experiencing issues with six-layer silent degradation, specifically with BM25 (Berk-Székely-Moody 25), truncation, and score mixing. This can lead to the loss of effective chunks. To fix this issue, you can try the following steps:\n\n**Step 1: Update the RAG model**\n\nRun the following command to update the RAG model to the latest version:\n```bash\npip install --upgrade ragg\n```\n**Step 2: Update the BM25 algorithm**\n\nUpdate the BM25 algorithm to the latest version:\n```bash\npip install --upgrade scibert\n```\n**Step 3: Increase the maximum chunk size**\n\nIncrease the maximum chunk size to prevent the loss of effective chunks. You can do this by setting the `max_chunk_size` parameter in the RAG configuration file:\n```python\n# rag_config.py\n\nRAG_CONFIG = {\n # ...\n 'max_chunk_size': 1024, # Increase the maximum chunk size\n # ...\n}\n```\n**Step 4: Disable score mixing**\n\nDisable score mixing by setting the `score_mixing` parameter to `False` in the R",
"metrics": {
"length": 1050,
"commands": 2,
"command_list": [
"pip install --upgrade ragg",
"pip install --upgrade scibert"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 8,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Three-Channel LLM Disaster Recovery (rag-three-channel-llm-disaster-recovery)",
"condition": "with_lesson",
"status": 200,
"content": "To implement three-channel automatic disaster recovery for the RAG knowledge base, you'll need to modify the Gradio application configuration and add error handling mechanisms. Here's a step-by-step guide to achieve this:\n\n**Step 1: Verify the current configuration**\n\nRun the following commands to inspect the current configuration:\n```bash\ngrep -i 'bm25\\|chunk\\|embed' lessons/contrib/rag-.md 2/dev/null | head -3\necho Search verified\n```\nThis should output the expected verification message.\n\n**Step 2: Update the Gradio application configuration**\n\nModify the `rag_three_channel_llm_disaster_recovery.py` file to include the three-channel configuration:\n```python\nimport gradio as gr\nfrom gradio import Text, Button, Image, Video, Audio\nfrom gradio import Component, ComponentGrid, MultiComponent\nfrom gradio.components import TextInput, Switch\nfrom gradio.components import ImageUpload, VideoUpload\nfrom gradio.components import AudioUpload\nfrom gradio.components import ComponentGrid\nfrom gradio.components import MultiComponent\nimport requests\nimport time\n\n# Define the three-channel configuration\nchannel_config = [\n {\n \"name\": \"Internal Model - Flash\",\n \"url\": \"http://",
"metrics": {
"length": 1195,
"commands": 2,
"command_list": [
"grep -i 'bm25\\|chunk\\|embed' lessons/contrib/rag-.md 2/dev/null | head -3",
"echo Search verified"
],
"has_command_block": true,
"actionable": false,
"inline_code_count": 3,
"lesson_hits": 4,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "正则陷阱 — 源码中转义引号导致非贪婪匹配提前终止 (regex-escaped-quotes-source-parsing)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you can use the following command:\n\n```bash\necho \"Verification passed: [^\\\\]|\\.\"\n```\n\nThis command uses a character class to match any character except backslash (`[^\\\\]`) or escape sequence (`\\\\.`).",
"metrics": {
"length": 217,
"commands": 1,
"command_list": [
"echo \"Verification passed: [^\\\\]|\\.\""
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 3,
"lesson_hits": 0,
"lesson_hit_rate": 0.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "RAG Three-Channel LLM Disaster Recovery (rag-three-channel-llm-disaster-recovery)",
"condition": "plain",
"status": 200,
"content": "I'm happy to help you with the error. However, I don't see any error message in your question. Could you please provide the exact error message you're encountering?\n\nThat being said, if you're experiencing issues with a Hugging Face model, such as the \"RAG Three-Channel LLM Disaster Recovery\" model, here are some general troubleshooting steps you can try:\n\n1. Check the model's documentation: Make sure you're using the model correctly and that you've checked the documentation for any specific requirements or usage guidelines.\n2. Verify your Python environment: Ensure that your Python environment is up-to-date and that you have the required libraries installed. You can try updating your environment by running `pip install --upgrade transformers`.\n3. Try a different version of the model: If you're using a specific version of the model, try updating to the latest version by running `pip install transformers --upgrade`.\n\nIf you're still experiencing issues, please provide the exact error message you're encountering, and I'll do my best to provide a concrete, actionable fix.\n\nHere is an example of how you might use the RAG model:\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# Load the model and tokenizer\nmodel_name = \"",
"metrics": {
"length": 1259,
"commands": 0,
"command_list": [],
"has_command_block": false,
"actionable": true,
"inline_code_count": 2,
"lesson_hits": 4,
"lesson_hit_rate": 1.0
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "rdt-cli — Reddit in Your Terminal (Reverse-Engineered API) (rdt-cli-reddit-terminal)",
"condition": "plain",
"status": 200,
"content": "It looks like the rdt-cli is not compatible with the latest versions of Python. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Update pip**\n\nOpen your terminal and update pip to the latest version:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n**Step 2: Install rdt-cli**\n\nNow, install rdt-cli using pip:\n\n```bash\npython -m pip install rdt-cli\n```\n\n**Step 3: Install required packages**\n\nrdt-cli requires some additional packages to be installed. You can install them using the following command:\n\n```bash\npython -m pip install -r rdt-cli/requirements.txt\n```\n\n**Step 4: Verify installation**\n\nAfter installing the packages, verify that rdt-cli is working correctly by running:\n\n```bash\nrdt-cli\n```\n\nIf you still encounter issues, make sure that you have the latest version of Python installed.\n\nNote: If you're using a virtual environment, ensure that you activate it before running the above commands.",
"metrics": {
"length": 917,
"commands": 4,
"command_list": [
"python -m pip install --upgrade pip",
"python -m pip install rdt-cli",
"python -m pip install -r rdt-cli/requirements.txt",
"rdt-cli"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 7,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "rdt-cli — Reddit in Your Terminal (Reverse-Engineered API) (rdt-cli-reddit-terminal)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error and verify that `rdt-cli` is installed correctly, follow these steps:\n\n1. **Install `rdt-cli` using pipx**: Run the following command in your terminal:\n ```bash\npipx install rdt-cli\n```\n\n2. **Verify the installation**: Run the following command to verify that `rdt-cli` is installed correctly:\n ```bash\nrdt --version\n```\n\n This should display the version number of `rdt-cli`, which is `v0.4.1` in your case.\n\n3. **Login to `rdt-cli`**: Run the following command to login to `rdt-cli`:\n ```bash\nrdt login\n```\n\n This will extract your browser cookies and authenticate you with the Reddit reverse-engineered API.\n\n4. **Verify successful login**: Run the following command to verify that you are logged in successfully:\n ```bash\nrdt status --json\n```\n\n This should display a JSON response indicating that you are authenticated and have a valid cookie count.\n\n5. **Verify with a verification command**: Run the following command to verify that `rdt-cli` is working correctly:\n ```bash\npipx install rdt-cli\necho \"",
"metrics": {
"length": 1040,
"commands": 4,
"command_list": [
"pipx install rdt-cli",
"rdt --version",
"rdt login",
"rdt status --json"
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 16,
"lesson_hits": 3,
"lesson_hit_rate": 0.5
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "正则陷阱 — 源码中转义引号导致非贪婪匹配提前终止 (regex-escaped-quotes-source-parsing)",
"condition": "plain",
"status": 200,
"content": "The error you're encountering is due to the fact that the regular expression engine is treating the double quotes in your regex pattern as literal characters instead of escaped quotes. This is because the regex engine is interpreting the double quotes as the start of a quoted string, rather than as an escaped character.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Using Python**\n\nYou can use raw strings in Python to avoid this issue. Raw strings are strings that start with `r` and do not interpret backslashes (`\\`) as escape characters.\n\n```python\nimport re\n\n# Define your regex pattern\npattern = r\"(\\w+) \\\"(.*?)\\\"\"\n\n# Use the raw string to define your regex pattern\nregex_pattern = r\"(\\w+) \\\"(.*?)\\\"\"\n\n# Compile the regex pattern\nregex = re.compile(regex_pattern)\n\n# Test the regex pattern\nmatch = regex.match(\"John \\\"Doe\\\"\")\nif match:\n print(\"Match found:\", match.groups())\nelse:\n print(\"No match found\")\n```\n\n**Using Bash**\n\nIn Bash, you can use single quotes (`'`) to define a raw string.\n\n```bash\n# Define your regex pattern\npattern='(\\w+) „(.*?)“'\n\n# Use the regex pattern to search",
"metrics": {
"length": 1114,
"commands": 2,
"command_list": [
"**Using Bash**",
"In Bash, you can use single quotes (`'`) to define a raw string."
],
"has_command_block": true,
"actionable": true,
"inline_code_count": 5,
"lesson_hits": 1,
"lesson_hit_rate": 0.167
},
"error": null
},
{
"model": "@cf/meta/llama-3.2-3b-instruct",
"scenario": "正则表达式 debugging — 贪婪匹配造成的意外结果 (regex-greedy-matching)",
"condition": "with_lesson",
"status": 200,
"content": "To fix the error, you need to modify the regular expression to make it non-greedy. You can do this by appending a question mark (`?`) after the `.*` or `.+` part of the pattern.\n\nHere's the corrected code:\n\n```python\nimport re\n\ntext = \"内容1
内容2
\"\n\n# Non-greedy pattern: matches the closest \", text))\n# Output: ['内容1', '内容2']\n```\n\nIn this corrected pattern, `.*?` is used instead of `.*` to make the match non-greedy. This will cause the pattern to match the closest `
` instead of the farthest one.\n\nAlternatively, you can use the `re.DOTALL` flag to make the `.` match any character, including a newline, and then use a non-greedy pattern:\n\n```python\nimport re\n\ntext = \"