Amazon Bedrock PluginInvokeError

I’m getting the following error in some random interactions in my flow.

Failed to transform agent message: req_id: {{id}} PluginInvokeError: {“args”:{},“error_type”:“Exception”,“message”:"read llm model failed: request failed: req_id: {{id}} PluginInvokeError: {\“args\”:{\“description\”:\"1 validation error for LLMResultChunk\\nmodel\\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\\n For further information visit https://errors.pydantic.dev/2.12/v/string_type\"},\“error_type\”:\“InvokeError\”,\“message\”:\"1 validation error for LLMResultChunk\\nmodel\\n Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]\\n For further information visit https://errors.pydantic.dev/2.12/v/string_type\“}”}

Does anyone know why this happens and how to solve it permanently?

I just encountered a plugininvoke error, which is the issue of being unable to call the AI model’s API. This might be due to the Docker daemon configuration missing DNS: /etc/docker/daemon.json only has image repository configuration, but lacks DNS configuration.
Solution 1: Modify Docker daemon configuration. This will fix DNS issues for all containers.

Execution Steps:

1. Backup Current Configuration

bash

echo "=== 1. Backup Current Configuration ==="
sudo cp /etc/docker/daemon.json /etc/docker/daemon.json.backup.$(date +%Y%m%d_%H%M%S)
echo "Backed up to: /etc/docker/daemon.json.backup"

2. Create New daemon.json Configuration

bash

echo "=== 2. Create New daemon.json Configuration ==="
sudo tee /etc/docker/daemon.json << 'EOF'
{
    "dns": ["223.5.5.5", "119.29.29.29", "114.114.114.114"],
    "dns-opts": ["timeout:2", "attempts:3", "rotate"],
    "registry-mirrors": [
        "https://do.nark.eu.org",
        "https://dc.j8.work",
        "https://docker.m.daocloud.io",
        "https://dockerproxy.com",
        "https://docker.mirrors.ustc.edu.cn",
        "https://docker.nju.edu.cn"
    ]
}
EOF

echo "New configuration content:"
sudo cat /etc/docker/daemon.json

3. Restart Docker Service

bash

echo "=== 3. Restart Docker Service ==="
sudo systemctl daemon-reload
sudo systemctl restart docker

echo "Waiting for Docker to restart..."
sleep 10

echo "Checking Docker status:"
sudo systemctl status docker | head -10

4. Restart All Dify Containers

bash

echo "=== 4. Restart All Dify Containers ==="
cd /root/dify/docker

# Stop all containers
docker-compose down

# Wait for cleanup
sleep 5

# Restart
docker-compose up -d

echo "Waiting for services to start..."
sleep 20

5. Verify Fix

bash

echo "=== 5. Verify DNS Fix ==="
# Test DNS resolution in each container
containers=("docker-api-1" "docker-plugin_daemon-1")

for container in "${containers[@]}"; do
    echo "Testing container: $container"
    echo "DNS configuration: $(docker inspect $container --format='{{.HostConfig.Dns}}')"
    echo "resolv.conf content:"
    docker exec $container cat /etc/resolv.conf 2>/dev/null || echo "Cannot access"
    
    # Test DNS resolution
    docker exec $container python3 -c "
import socket
try:
    ip = socket.gethostbyname('baidu.com')
    print(f'✅ DNS resolution successful: baidu.com -> {ip}')
    
    ip2 = socket.gethostbyname('pypi.org')
    print(f'✅ DNS resolution successful: pypi.org -> {ip2}')
    
    ip3 = socket.gethostbyname('pypi.tuna.tsinghua.edu.cn')
    print(f'✅ DNS resolution successful: Tsinghua mirror -> {ip3}')
except Exception as e:
    print(f'❌ DNS resolution failed: {e}')
" 2>/dev/null || echo "Container has no Python, testing with other methods"
    echo "---"
done

6. Test External API Connection

bash

echo "=== 6. Test External API Connection ==="
docker exec docker-api-1 python3 -c "
import urllib.request
import socket
import ssl

# Skip SSL verification
ssl._create_default_https_context = ssl._create_unverified_context

print('Testing external API connection:')
apis = [
    ('Baidu', 'https://www.baidu.com'),
    ('Tsinghua Mirror', 'https://pypi.tuna.tsinghua.edu.cn'),
    ('PyPI', 'https://pypi.org'),
]

for name, url in apis:
    try:
        req = urllib.request.urlopen(url, timeout=10)
        print(f'✅ {name}: Connected (HTTP {req.status})')
    except Exception as e:
        print(f'❌ {name}: Connection failed - {str(e)[:100]}')
"

7. Check Plugin Status

bash

echo "=== 7. Check Plugin Status ==="
docker-compose logs --tail=20 plugin_daemon | grep -i "siliconflow\|jina\|install\|ready\|failed" | head -10