Skip to content

Client keeps crashing #92

Client keeps crashing

Client keeps crashing #92

Workflow file for this run

name: Check Minecraft crash
on:
issues:
types: [opened]
jobs:
check-minecraft-crash:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 #v3.7.0
with:
node-version: 16
- run: npm install axios
- name: Check Minecraft crash
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
script: |
// Strings which indicate that Minecraft is modded
const moddedStrings = [
'net.fabricmc.loader.launch.knot.KnotClient',
'net.fabricmc.loader.impl.launch.knot.KnotClient', // new class name
'--version fabric-loader-',
'--tweakClass optifine.OptiFineTweaker',
// Minecraft Forge
'--launchTarget forgeclient',
'--launchTarget fmlserver',
'--fml.forgeVersion',
]
const axios = require('axios')
async function httpGet(url) {
const result = await axios.get(url, {
responseType: 'text'
})
const status = result.status
const data = result.data
if (status < 200 || status >= 300) {
throw new Error(`GET request to ${url} failed with ${status} '${result.statusText}': ${data}`)
}
return data
}
const issueNumber = context.issue.number
const owner = context.repo.owner
const repo = context.repo.repo
const issueData = (await github.rest.issues.get({
owner: owner,
repo: repo,
issue_number: issueNumber,
})).data
const issueTitle = issueData.title
const issueBody = issueData.body
// Uses negative lookbehind and lookahead to match start and end of string as well
const minecraftRegex = /(?<![a-z])Minecraft(?![a-z])/i
let isMinecraftIssue = minecraftRegex.test(issueTitle) || minecraftRegex.test(issueBody)
const foundModdedStrings = moddedStrings.filter(s => issueBody.includes(s))
if (foundModdedStrings.length === 0) {
console.log('Did not find modded string in issue body, searching attachments')
// Try searching in attachments
// There is currently no API so try to find URL then get attachment content, see https://github.community/t/get-files-attached-in-issue/117443
const attachmentPattern = new RegExp(`https://github\\.com/${owner}/${repo}/files/\\d+/[a-zA-Z0-9_\\-.]+`, 'g')
const attachmentUrls = Array.from(issueBody.matchAll(attachmentPattern), m => m[0])
console.log('Found attachment URLs', attachmentUrls)
for (const url of attachmentUrls) {
let attachment = undefined
try {
attachment = await httpGet(url)
} catch (e) {
// Only log message because complete error is rather verbose
console.log('Failed getting attachment for ' + url, e.message)
continue
}
if (!isMinecraftIssue) {
isMinecraftIssue = minecraftRegex.test(attachment)
if (isMinecraftIssue) {
console.log('Found Minecraft string in attachment')
}
}
moddedStrings.forEach(s => {
if (attachment.includes(s)) {
foundModdedStrings.push(s)
}
})
}
}
let isCrashFromModdedMinecraft = foundModdedStrings.length > 0
if (isCrashFromModdedMinecraft) {
console.log('Found modded strings', foundModdedStrings)
} else {
console.log('Did not find modded strings')
}
isMinecraftIssue = isMinecraftIssue || isCrashFromModdedMinecraft
console.log('Is Minecraft issue: ' + isMinecraftIssue)
if (isMinecraftIssue) {
let commentBody
if (isCrashFromModdedMinecraft) {
// Don't tell user to report modded crashes on Mojang's bug tracker; they will most likely be considered Invalid
commentBody = (
'Thank you for the report!'
+ '\nIt looks like you are using a modified version of Minecraft. The following was detected in your crash report:'
+ '\n```'
+ '\n' + foundModdedStrings.join('\n')
+ '\n```'
+ '\nPlease try the following:'
+ '\n- Update your graphics drivers, see [this Minecraft Help Center article](https://help.minecraft.net/hc/en-us/articles/4409137348877-Minecraft-Java-Edition-Game-Crashes-and-Performance-Issues-FAQ), section "Update your Video Card Drivers";'
+ '\n often Minecraft crashes are caused by outdated graphics drivers'
+ '\n- Try disabling the mods you have installed one by one until you find the mod causing the crash, then report the crash to the mod author'
+ '\n- If you are using a third-party launcher, try the [official launcher](https://www.minecraft.net/download) instead'
+ '\n\nIf none of the above helped, and you are still experiencing the crash with the official launcher and without any mods installed, please submit this issue over at the [Mojang bug tracker](https://bugs.mojang.com/projects/MC/summary).'
+ ' Please search for existing reports first; in case you do not find any, create a new report and let us know about the issue number here (e.g. `MC-123456`).'
+ '\nThe Mojang team will take the first look. If an OpenJDK bug is identified, the Mojang team will contact us to address the issue.'
)
} else {
commentBody = (
'Thank you for the report!'
+ '\nIt looks like you are reporting that the game Minecraft crashed for you. Please try the following:'
+ '\n- Update your graphics drivers, see [this Minecraft Help Center article](https://help.minecraft.net/hc/en-us/articles/4409137348877-Minecraft-Java-Edition-Game-Crashes-and-Performance-Issues-FAQ), section "Update your Video Card Drivers";'
+ '\n often Minecraft crashes are caused by outdated graphics drivers'
+ '\n- In case you are using mods, try disabling them one by one until you find the mod causing the crash, then report the crash to the mod author'
+ '\n- If you are using a third-party launcher, try the [official launcher](https://www.minecraft.net/download) instead'
+ '\n\nIf none of the above helped, and you are still experiencing the crash with the official launcher and without any mods installed, please submit this issue over at the [Mojang bug tracker](https://bugs.mojang.com/projects/MC/summary).'
+ ' Please search for existing reports first; in case you do not find any, create a new report and let us know about the issue number here (e.g. `MC-123456`).'
+ '\nThe Mojang team will take the first look. If an OpenJDK bug is identified, the Mojang team will contact our team to address the issue.'
)
}
github.rest.issues.createComment({
owner: owner,
repo: repo,
issue_number: issueNumber,
body: commentBody
})
// Add Minecraft label
github.rest.issues.addLabels({
owner: owner,
repo: repo,
issue_number: issueNumber,
labels: ['Minecraft']
})
// We will close any Minecraft-related issue automatically
github.rest.issues.update({
owner: owner,
repo: repo,
issue_number: issueNumber,
state: 'closed'
})
}