Recently How to solve common errors in Google Apps Script development was posted and had several upvotes, but it was also closed.
NOTE: This is not a duplicate of What to do about hundreds of the same basic question? because this about an specific question which discussion through comments is becoming lengthy
The question has several problems.
- It's not a question
- It's too broad (it's about "common error"s, not about a specific error)
- It's primarily opinion-based (while there is a list of "examples" there aren’t explicit criteria to qualify which errors are common, i.e., the minimum pages that searching an error should be returned)
- It's a "listing" question type
- The conversation in the comments is lengthy (the question was posted June 12th, 2020, and it had 18 comments the next day, at the time that this post was created, as Oct 7th, 2022 it has +20 comments still shown)
- It's not a good "original" to close as duplicate good questions as each answer is about a different error that might not have common causes / solutions.
Regarding the answers (so far it has 2)
- They are a list of errors. While they are using headings, because their length and the SO lack of inner-links (i.e., TOC linking to each header) it's "hard" to jump directly to the section of interest (if you have the error text using the web browser "find" command will do the job).
As of Oct 2022, the question is open.
Preface
This Q&A strives to become a collection and a reference target for common errors encountered during development in Google Apps Script language in hopes to improve long-term maintainability of google-apps-script tag.
There are several similar and successful undergoings in other languages and general-purpose tags (see c++, android, php, php again), and this one follows suit.
Why it exists?
The amount of questions from both new and experienced developers regarding the meaning and solutions to errors encountered during development and production that can be effectively reduced to a single answer is substantial. At the time of writing, even running a query only by language tag yields:
- "Cannot find method" 8 pages
- "Cannot read property" 9 pages
- "Cannot call ... in this context" 5 pages
- "You do not have permission" 11 pages
Linking to a most relevant duplicate is hard and time-consuming for volunteers due to the need to consider nuances and often poorly-worded titles.
What it consists of?
Entries in this Q&A contain are designed as to provide info on how to:
- parse the error message structure
- understand what the error entails
- consistently reproduce (where applicable)
- resolve the issue
- provide a link to canonical Q&A (where possible)
What this is not?
The scope of the Q&A is limited to common (not trivial). This is not:
- a catch-all guide or "best practices" collection
- a reference for general ECMAScript errors
- GAS documentation
- a resources list (we have a tag wiki for that)
What to add?
When adding an entry, please, consider the following:
- is the error common enough (see "why" section for examples)?
- can the solution be described concisely and be applicable for most cases?
! The initial answer is a community wiki already and the question is intended to become one as well as soon as the status of the Q&A itself is resolved. You are most welcome and encouraged to contribute
Related