Explain Error

Build Status Jenkins Plugin GitHub Release Jenkins Plugin Installs

Explain Error Plugin Logo

AI-powered Jenkins plugin that explains pipeline and job failures with human-readable insights.

Overview

Tired of digging through long Jenkins logs to understand what went wrong?

Explain Error Plugin leverages AI to automatically interpret job and pipeline failures—saving you time and helping you fix issues faster.

Whether it’s a compilation error, test failure, or deployment hiccup, this plugin turns confusing logs into human-readable insights.

Key Features

  • 🔍 One-click error analysis on any console output
  • ⚙️ Pipeline-ready with a simple explainError() step
  • 💡 AI-powered explanations using OpenAI GPT models
  • 🌐 Rich web UI for viewing AI-generated insights
  • 🎯 Customizable: set model, API endpoint, log filters, and more

Quick Start

Prerequisites

  • Jenkins 2.479.3+
  • Java 17+
  • OpenAI API Key

Installation

  1. Install via Jenkins Plugin Manager:

    • Go to Manage JenkinsManage PluginsAvailable
    • Search for "Explain Error Plugin"
    • Click Install and restart Jenkins
  2. Manual Installation:

    • Download the .hpi file from releases
    • Upload via Manage JenkinsManage PluginsAdvanced

Configuration

  1. Go to Manage JenkinsConfigure System
  2. Find the "Explain Error Plugin Configuration" section
  3. Configure the following settings:
Setting Description Default
Enable AI Error Explanation Toggle plugin functionality ✅ Enabled
API Key Your OpenAI API key Required. you can get one here
API URL AI service endpoint https://api.openai.com/v1/chat/completions
AI Model Model to use for analysis gpt-3.5-turbo
  1. Click "Test Configuration" to verify your setup
  2. Save the configuration

Configuration

Configuration as Code (CasC)

This plugin supports Configuration as Code for automated setup. Use the explainError symbol in your YAML configuration:

unclassified:
  explainError:
    enableExplanation: true
    apiKey: "${AI_API_KEY}"
    apiUrl: "https://api.openai.com/v1/chat/completions"
    model: "gpt-3.5-turbo"

Environment Variable Example:

export AI_API_KEY="your-openai-api-key-here"

This allows you to manage the plugin configuration alongside your other Jenkins settings in version control.

Usage

Method 1: Pipeline Step

Use explainError() in your pipeline (e.g., in a post block):

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                script {
                    // Your build steps here
                    sh 'make build'
                }
            }
        }
    }
    post {
        failure {
            // Automatically explain errors when build fails
            explainError()
        }
    }
}

Optional parameters:

explainError(
  maxLines: 500,
  logPattern: '(?i)(error|failed|exception)'
)

Output appears in the sidebar of the failed job.

Side Panel - AI Error Explanation

Method 2: Manual Console Analysis

Works with Freestyle, Declarative, or any job type.

  1. Go to the failed build’s console output
  2. Click Explain Error button in the top
  3. View results directly under the button

AI Error Explanation

Troubleshooting

Issue Solution
API key not set Add your key in Jenkins global config
Auth or rate limit error Check key validity, quota, and OpenAI plan
Button not visible Ensure Jenkins version ≥ 2.479.3, restart Jenkins after installation

Enable debug logs:

Manage JenkinsSystem Log → Add logger for io.jenkins.plugins.explain_error

Best Practices

  1. Use explainError() in post { failure { ... } } blocks
  2. Apply logPattern to focus on relevant errors
  3. Monitor your OpenAI usage to control costs
  4. Keep plugin updated regularly

Support & Community

License

Licensed under the MIT License.

Acknowledgments

Built with ❤️ for the Jenkins community. If you find it useful, please ⭐ us on GitHub!