Skip to content

Conversation

@ramotar
Copy link

@ramotar ramotar commented Nov 11, 2025

TL;DR

  • fixed error in error message creation, should provide meaningful information
  • solved (at least one) underlying problem

Should help with (if not fix) #135 and #142


Since I also got the [github assistant] undefined error from time to time, I took the time do dig into it a little more.

In my case the issue most often appeared during pull operations (since I don't push often) and was usually resolved by reloading the page or something like that (so the GitHub token is fine and Script API is working).

Using the Chrome Developer Tools, I was able to pin down the call in script-api.js, that produced this unhelpful error message. At its core, it was doing something like

$.ajax({ ... })
  .then( ... )
  .catch((err) => {
    showLog(err.message, LEVEL_ERROR);
  });

The problem is, that the AJAX call always returns a jqXHR object, which has no message property. The changes to script-api.js retrieve a meaningful error message from the object.

With the error messages I was able to identify the problems I was having:

  1. malformed or incompatible code in the SCM would cause an error on pull
    not bad, just fix the code
  2. weird messages saying "A file with this name already exists in the current project: {filename}"
    definitely needed some investigation

After checking the requests I could see, that some files where duplicated within the request - exactly those producing the error message. So I looked into the creation of the file list and the duplicates were already in the initial list:

const changed = $('.diff-file:checked').toArray().map(elem => elem.value);

This was caused by a duplication of the diff modal, that is shown to the user to select which files he wants to keep. If there are two or more instances of this modal, than the code line above will find two or more checkboxes per file and add those to the list of files.

The duplicate modals seem to be created when the user switches between the editor and the other pages - which is why a reload usually helped. I added a check to the corresponding function in gas-hub.js to prevent multiple modals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants