Collect Mistral AI debug evidence for support tickets and troubleshooting.
Use when encountering persistent issues, preparing support tickets,
or collecting diagnostic information for Mistral AI problems.
Trigger with phrases like "mistral debug", "mistral support bundle",
"collect mistral logs", "mistral diagnostic".
Collect all necessary diagnostic information for Mistral AI support tickets. Creates a redacted bundle with environment info, SDK versions, API connectivity test, available models, and recent error logs.
Prerequisites
Mistral AI SDK installed
Access to application logs
MISTRAL_API_KEY set (for connectivity test)
Instructions
Step 1: Complete Debug Script
#!/bin/bash
# mistral-debug-bundle.sh — Creates redacted support bundle
set -e
BUNDLE_DIR="mistral-debug-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BUNDLE_DIR"
echo "Creating Mistral AI debug bundle..."
# === Environment Info ===
cat > "$BUNDLE_DIR/summary.txt" << EOF
=== Mistral AI Debug Bundle ===
Generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)
Hostname: $(hostname)
--- Environment ---
Node.js: $(node --version 2>/dev/null || echo 'not installed')
Python: $(python3 --version 2>/dev/null || echo 'not installed')
npm: $(npm --version 2>/dev/null || echo 'not installed')
OS: $(uname -a)
MISTRAL_API_KEY: ${MISTRAL_API_KEY:+[SET, length=${#MISTRAL_API_KEY}]}${MISTRAL_API_KEY:-[NOT SET]}
EOF
# === SDK Versions ===
echo -e "\n--- SDK Versions ---" >> "$BUNDLE_DIR/summary.txt"
npm list @mistralai/mistralai 2>/dev/null >> "$BUNDLE_DIR/summary.txt" \
|| echo "Node SDK: not installed" >> "$BUNDLE_DIR/summary.txt"
pip show mistralai 2>/dev/null | grep -E "^(Name|Version)" >> "$BUNDLE_DIR/summary.txt" \
|| echo "Python SDK: not installed" >> "$BUNDLE_DIR/summary.txt"
# === API Connectivity ===
echo -e "\n--- API Connectivity ---" >> "$BUNDLE_DIR/summary.txt"
if [ -n "${MISTRAL_API_KEY:-}" ]; then
HTTP_STATUS=$(curl -s -o "$BUNDLE_DIR/api-response.json" -w "%{http_code}" \
-H "Authorization: Bearer ${MISTRAL_API_KEY}" \
https://api.mistral.ai/v1/models 2>/dev/null)
echo "HTTP Status: $HTTP_STATUS" >> "$BUNDLE_DIR/summary.txt"
if [ "$HTTP_STATUS" = "200" ]; then
echo -e "\n--- Available Models ---" >> "$BUNDLE_DIR/summary.txt"
jq -r '.data[].id' "$BUNDLE_DIR/api-response.json" >> "$BUNDLE_DIR/summary.txt" 2>/dev/null
fi
rm -f "$BUNDLE_DIR/api-response.json"
else
echo "Skipped (no API key)" >> "$BUNDLE_DIR/summary.txt"
fi
# === Dependencies ===
if [ -f "package.json" ]; then
echo -e "\n--- Dependencies ---" >> "$BUNDLE_DIR/summary.txt"
jq '{dependencies, devDependencies}' package.json 2>/dev/null >> "$BUNDLE_DIR/summary.txt"
fi
# === Recent Logs (redacted) ===
echo "--- Recent Logs (redacted) ---" > "$BUNDLE_DIR/logs.txt"
if [ -d "logs" ]; then
grep -i "mistral\|error\|429\|401\|500" logs/*.log 2>/dev/null | tail -100 >> "$BUNDLE_DIR/logs.txt"
fi
# === Config (redacted) ===
if [ -f ".env" ]; then
sed 's/=.*/=***REDACTED***/' .env > "$BUNDLE_DIR/config-redacted.txt"
fi
# === Reproduction Script ===
cat > "$BUNDLE_DIR/reproduce.sh" << 'SCRIPT'
#!/bin/bash
set -euo pipefail
curl -X POST https://api.mistral.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${MISTRAL_API_KEY}" \
-d '{"model":"mistral-small-latest","messages":[{"role":"user","content":"ping"}]}' 2>&1
echo -e "\nExit code: $?"
SCRIPT
chmod +x "$BUNDLE_DIR/reproduce.sh"
# === Package ===
tar -czf "$BUNDLE_DIR.tar.gz" "$BUNDLE_DIR"
rm -rf "$BUNDLE_DIR"
echo "Bundle: $BUNDLE_DIR.tar.gz"
echo "IMPORTANT: Review for sensitive data before sharing!"