text:
Find an Illegal String
The challenge is to find a string of characters that cannot appear in any legal program in your programming language of choice. That includes comments, strings, or other "non-executable" parts.
Challenge

Your program may be specific to a particular version or implementation of your language's compiler/interpreter/runtime environment. If so, please specify the particulars.
Only standard compiler/interpreter/runtime options are permitted. You cannot pass some weird flag to your compiler to get a specific result (e.g. passing a flag to convert warnings into errors).
If your programming language requires a specific encoding (e.g. UTF-8), your string must also be correctly encoded (i.e. strings which fail solely due to character decoding errors are not allowed).
Every individual character in your submission must be admissible in a legal program; that is, you can't just use a character which is always rejected.
The compiler/interpreter/runtime must give an error when given any source code that contains your string as a substring. The error does not have to be the same across programs - one embedding of your string might cause a syntax error, while another might cause a runtime error.

Scoring

Shortest illegal string for each language wins.
You should explain why your string is illegal (why it cannot appear anywhere in a legal program).
Dispute incorrect solutions in the comments. More specifically, you should provide a link to TIO or equivalent demonstrating a legal program (i.e. one that doesn't produce any errors) that contains the proposed substring.
Some languages (e.g. Bash, Batch, Perl) allow arbitrary binary data to be appended to a program without affecting validity (e.g. using __DATA__ in Perl). For such languages, you may submit a solution that can appear only in such a trailing section. Make sure to make a note of that in your answer. (The definition of this "trailing section" is language-dependent, but generally means any text after the parser has entirely stopped reading the script).

Example
In Python, I might submit
x
"""
'''

but this can be embedded into the larger program
"""
x
"""
'''
y
'''

so it isn't admissible.

Can a counter-example rely on input from STDIN?

Would this make a good CnR?

@CalculatorFeline: Only for languages where parsing is immediate (not performed in advance) - this is true of Bash and Batch for example. For those languages, I allow for a small exception - see the last Scoring point.

@Zacharý: I think that a counterexample is valid if any execution of the program can complete successfully (i.e. if there is some way to run the program such that it doesn't crash). Therefore, a string is not illegal if it can be embedded in some program that doesn't crash on some input.

@CalculatorFeline: As for CnR, I considered it during the sandbox proposal, but decided against it because legitimate solutions will receive zero robber submissions (i.e. things get boring for the robbers). But, if it turns out that a lot of submissions are faulty, I may convert the question to CnR so we can weed out non-illegal strings.

Too late now I guess, but it seems like this could have been a cops and robbers challenge. There's a lot of skill evident in the attempts to make valid programs, as well as coming up with the strings in the first place.

Does it count if the standard IDE crashes at entering the string? (truely crashes)

My condolences to the Perl attempts. :)

@Kaz Well, there are only a finite number of Unicode characters that could be doubled to close an s@-like quote...

I think it is impossible in Perl 6 as you can use an arbitrary number of delimiting characters for a string literal Q{{{{{{{{{{ab｣}}｣cd}}}}}}}}}} (ab｣}}｣cd), andQ literals don't do any sort of interpretation of their contents.

In forth this seems nearly impossible, given the ability to overwrite effectively any word/symbol. I'm sure there are probably ways to do it by redefining core system words but nothing that couldn't appear after some code that backs those words up as other words first.

@reffu Yeah, I tried to create one in Forth when the challenge was first posted. I didn't succeed.

Can we assume that the program will not be given input? I have an answer, but only errors when no input is given, but works otherwise.

As long as you note that in your answer, I think it’s fair to assume no input.

I'm pretty sure it's completely impossible in non-literate Haskell, thanks to nested comments.

@dfeuer That was my conclusion too. I even looked through GHC's lexer code to see if there was a loophole, but it seems very diligent about allowing absolutely every byte sequence inside sufficiently nested {- -} brackets.

This challenge rules out Turing Machine Language.

Changeling, 2 bytes

That's two linefeeds. Valid Changeling must always form a perfect square of printable ASCII characters, so it cannot contain two linefeeds in a row.
The error is always a parser error and always the same:
This shape is unpleasant.

accompanied by exit code 1.
Try it online!

This also works with 2Col. Try it online!. But the reason this breaks in 2Col is that every line needs to consist of exactly 2 characters, but the empty line breaks that.

+1 because this is automatically the winner, since 1-byte solutions are not allowed because "you can't just use a character which is always rejected."

@Cowsquack tfw I forgot about my own language

@Skidsdev tfw I re-forgot about my own language, and forgot about me forgetting about my own language

@Zacharý What about 0-byte solutions?

@PyRulez, then it wouldn't be a language that could do anything.

@Zacharý I know just the esolang for the job!

Java, 4 bytes
;\u;

Try it online!
This is an invalid Unicode escape sequence and will cause an error in the compiler.
error: illegal unicode escape

Doesn't work - one could have a string literal like "\\u;".

@feersum Fixed at the cost of one byte

Does this work for the /* and // comments?

@TheLethalCoder: Java preprocesses source code to alter \uXXXX escapes before doing anything else, so yes, this will work even inside comments.za

I think this is the shortest Java answer in the history of this site still..

@MagicOctopusUrn Actually, there is this 0 bytes Java answer (which isn't relevant anymore in the current meta, since it outputs to STDERR instead of STDOUT). Although both are pretty amazing and clever. :)

COBOL (GNU), 8 bytes

THEGAME

First, a linefeed to prevent you from putting my word in a commented line.
Then, historically, COBOL programs were printed on coding sheets, the compiler relies heavily on 80-character limited lines, there are no multiline comments and the first 6 characters are comments (often used as editable line numbers), you can put almost anything there, AFAIK. I chose THEGAM at the beginning of the next line.
Then, the 7th symbol in any line only accepts a very restricted list of characters : Space (no effect), Asterisk (comments the rest of the line), Hyphen, Slash, there may be others, but certainly not E.
The error given by GnuCobol, for instance, is :
error: invalid indicator 'E' at column 7

Try it online!
Also, you just lost the game.

Also, you just lost the game. I almost downvoted

JavaScript, 7 bytes

;*/\u)
Note the leading newline.

\u) is an invalid Unicode escape sequence and this is why this string is invalid
Adding a // at the beginning will still not work because of the leading newline, leaving the second line uncommented
Adding a /* will not uncomment the string completely because of the closing */ that completes it, leaving the \u) exposed
As stated by @tsh, the bottom line can be turned into a regex by having a / after the string, so by having the ) in front of the \u, we can ensure that the regex literal will always be invalid
As stated by @asgallant, one could do 1||1(string)/ to avoid having to evaluate the regex. The semi-colon at the beginning of the second line stops that from happening by terminating the expression 1||1 before it hits the second line, thus forcing a SyntaxError with the ;*.

Try it!

clicky.onclick=a=>{console.clear();console.log(eval(before.value+"\n;*/\\u)"+after.value));}
textarea {
  font-family: monospace;
}
<button onclick="console.clear();">Clear console</button>

<textarea id=before placeholder="before string"></textarea>

 */\u)

<textarea id=after placeholder="after string"></textarea>

<button id=clicky>Evaluate</button>

/* */\u0045 = 3 seems valid JavaScript code.

@tsh Fixed at the cost of one byte.

3 */\u;/ is still valid.

@tsh Fixed by changing the ; to a )

It is strange that Node.js accept code 0&&3 */\u)/, but javascript shell reject it.

Doesn't work. Add 1||1 to the beginning and / to the end. Evaluates to 1 , and the 1*/\u)/ is never executed, so the invalid regex doesn't come into play.

@asgallant Fixed at the cost of one byte, a semicolon at the beginning of the second line.

Interesting to note that as of ES2018 (which won't be official until the end of this year) you can just wrap the whole thing in backticks due to this. You could probably fix this though just by inserting a backtick after the / (not that you need to fix it). (Also, the ; doesn't force the parsing of the bad regex, it forces a SyntaxError with the *.)

I believe this solution is also valid for C? All the relevant syntax is identical, although you don't need to guard against regex stuff. (It's probably a polyglot for several curly-brace languages.)

@Leushenko But this doesn't work against #if 0 as seen here: Try it online!

@ETHproductions Fixed now

@Cowsquack yeah I misunderstood the C tokenization rules. Seems \u doesn't start a universal char name unless there is an actual hex-quad to follow it, so it's just a well-formed punctuator+identifier pair that can be safely escaped (6.4p4).

@feersum But alas, there is a leading newline (before the semicolon), so that cannot work.

@Cowsquack. You can save 1 byte by reverting to the old answer. See this issue. According to the ES spec, even if you put the regex into if(0) block (for example) such that it "never come into play", it is still syntax error (v8 engine currently doesn't throw an error because of the bug I posted, which will be fixed soon). You can also check section "Early syntax errors and RegExp errors" section from the latest ES spec.

@ThePirateBay Which particular old answer are you referring to?

@Cowsquack. To the asnwer */\u). In the comments asgallant said that you can put 1||1*/\u)/ and it will be correct (because regex will never be evaluated). But, it is wrong. In my previous comment I posted documented v8 bug (you can read all comments there and you can read whole ES spec section "Early errors"). The spec says that 1||1*/\u)/ is not a correct code (but v8 engine (which is Chrome and Node.js) doesn't throw error). The v8 issue is documented and will be fixed soon, so you can revert to 6 bytes answer, because it is perfectly valid.

@ThePirateBay Until the bug gets fixed, or until there is an implementation that allows */\u) as a valid string, I will have to stick with this version, as languages in PPCG are defined by their interpreter/implementation.

@Cowsquack. Then you should change your answer's title from JavaScript to JavaScript (v8 engine only). The bug appears only in v8 engine and it is unconsistent with the spec. If you're looking for an interpreter which rejects 1||1*/\u)/ as a valid code, you can test it in Mozilla Firefox, ParseHub, Babel Interpreter, Opera, Safari, and every other browser except Chrome.

In newer JS versions, String.raw with a template string can make this not break, because the invalid escape fails. Would be: String.raw`code here`

Python, 10 bytes (not cpython)

?"""?'''?

Edit:
Due to @feersum's diligence in finding obscure ways to break the Python interpreter, this answer is completely invalidated for any typical cpython environment as far as I can tell! (Python 2 and 3 for both Windows and Linux) I do still believe that these cracks will not work for Pypy on any platform (the only other Python implementation I have tested).
Edit 2:
In the comments @EdgyNerd has found this crack taking advantage of a non-ascii encoding declaration! This seems to decode to print(""). I don't know exactly how this was found but I imagine the way to fix this sort of exploit would maybe be to try different combinations of any invalid characters where the ?s are, and find one that doesn't behave well with any encoding.

Note the leading newline.
Cannot be commented out due to the newline, and no combination of triple quoted strings should work if I thought about this correctly.
@feersum in the comments seems to have completely broken any cpython program on Windows as far as I can tell by adding the 0x1A character to the beginning of a file. It seems that maybe (?) this is due to the way this character is handled by the operating system, apparently being a translated to an EOF as it passes through stdin because of some legacy DOS standard.
In a very real sense this isn't an issue with python but with the operating system. If you create a python script that reads the file and uses the builtin compile on it, it gives the more expected behavior of throwing a syntax error. Pypy (which probably does just this internally) also throws an error.

@isaacg hmm, I actually did think of that but https://repl.it/JaHm/0 didn't work

@isaacg Oh I didn't notice, on that site you have to click the debug tab to see that it does indeed produce an error.

@isaacg like others said, that code produces errors under the debug menu.

You're right, I don't know how to use TIO. Sorry about that.

I think this is valid, even when we remove the 1st and 3rd question marks??

@officialaimm consider """?'''"""

Oh, yes. Silly me!!

I made a program with this substring that runs on my machine. However, I think it does not run on many interpreters/platforms/versions. Can you specify which version of Python interpreter and OS this answer is targeting?

@feersum I edited the answer, does your program work on any online interpreters? Even if not I'd be interested in seeing the actual code

Unless you stick a second newline in front, people can just comment this out with #\.

@user2357112 see above comments, backslash continuation apparently doesn't work inside comments https://repl.it/JaHm/0

Apparently comments always end at the end of the physical line, so you can't line-continue them.

Python 3 on Windows 7 happens to be exactly where my crack is working. Pastebin of base64-encoded program

I can crack this one as well. Simply put a 0x1A character at the beginning of the file, and all the rest of it is ignored (this actually works for Python 3 as well).

Corrected crack for Pythons 2 and 3 on Linux. I realized I forgot to insert the leading newline.

I know this is really old, but after working with some people over in the Python Discord, we found this crack, although I don't know if changing the encoding can be considered cheating

@feersum  Could you explain how your crack work? What does the first line # ␀␄␀␄ of your script do?…

I believe @feersum 's cracks fall under the exception for "places where arbitrary trailing data is allowed" and don't invalidate this answer. I don't understand EdgyNerd's crack well enough to judge its validity

Are any of these reported as bugs?

C (clang), 16 bytes
 */
#else
#else

Try it online!
*/ closes any /* comment, and the leading space makes sure we didn’t just start one.  The newline closes any // comment and breaks any string literal.  Then we cause an #else without #if or #else after #else error (regardless of how many #if 0s we might be inside).

Cracked again.

Also since C++11 raw strings seem to work, a solution is impossible with gcc.

@feersum Huh, TIL that GCC accepts those in C code. I could specify -std=c99, but let’s try switching to clang.

I'm really surprised that gcc accepts C++11 raw strings. Specifying the compiler version or implementation is perfectly OK, so if it's illegal in Clang, it's fair game.

Can they close raw string again? @feersum

@l4m2 I can't parse your question (who is they, and what do you mean by again?), but note that a C++ raw string literal supports a custom delimeter:  R"foobar(...)foobar", and only a right paren followed by the matching delimeter and a quote will close it.

Is there a reason you need two #else statements, rather than just #elif followed by an invalid preprocessing token?

@Bbrk24 Yes; an invalid #elif line can be skipped by two #if 0 lines or one #if 1 line.

Rust, 65540 bytes
`"###... a lot more #s ###

That is a backtick, quote, 65535 #s, and an invisible U+202A Per this advisory there is an issue with Unicode bidirectional overrides that can cause Unicode-aware editors to misrender the code, allowing bad actors to hide malicious code in plain sight. Starting in rust 1.56.1, rustc contains mitigation for that vulnerability, preventing the use of the relevant codepoints by default anywhere in the source code. However, the text_direction_codepoint_in_literal lint can be set to allow or warn to let use it in string literals. String literals are tricky to break out of, mainly because raw string literals are designed to allow any valid utf8 within them.  However, take a look at rustc's lexer, and you will find something interesting- no more than 65535 hashtags are permitted in delimiters. Simply adding the quote followed by the long string of hashtags is enough to break any attempts at surrounding it in strings, and the U+202A is always invalid anywhere but a string. However there is another problem- someone could use the starting quote to begin a string, and hide the nastiness that way. This is where the backtick comes into play- it is an error anywhere but a literal or a comment, thus making it truly impossible for rust to contain this code. If you're wondering if there is an easier solution that fails after the lexer you'd be disappointed- anything that passes the lexer can be thrown away by a macro, and tacking on a #[cfg(nope)] will make anything that parses disappear.
edit: an actually valid answer this time

This solution is incorrect. \r by itself is allowed in regular comments (however not doc-comments).

@KonradBorowski fixed, an update to rust made that strategy completely obsolete.

"Every individual character in your submission must be admissible in a legal program; that is, you can't just use a character which is always rejected." If this is only a single U+202A, wouldn't this violate that rule?

@Bbrk24 should be fixed- after a little digging, I figured out that if you try hard enough you can put U+202A inside your code.

I was going to say that it's possible to allow a lint with #![allow(text_direction_codepoint_in_comment)], but as it happens, in Rust 1.56.1 this lint was incorrectly declared and as such the compiler is not aware of it, see https://github.com/rust-lang/rust/issues/90614. Due to that, this is a valid solution.

Ada - 2 bytes
I think this should work:

_
That's newline-underscore. Newline terminates comments and isn't allowed in a string. An underscore cannot follow whitespace; it used to be allowed only after letters and numbers, but the introduction of Unicode made things complicated.

Welcome to the site! :)

Pyth, 6 bytes
¡¡$¡"¡

¡ is an unimplemented character, meaning that if the Pyth parser ever evaluates it, it will error out with a PythParseError. The code ensures this will happen on one of the ¡s.
There are three ways a byte can be present in a Pyth program, and not be parsed: In a string literal (" or .", which are parsed equivalently), in a Python literal ($) and immediately after a \.
This code prevents \ from making it evaluate without error, because that only affects the immediately following byte, and the second ¡ errors.
$ embeds the code within the $s into the compiled Python code directly. I make no assumptions about what might happen there.
If the program reaches this code in a $ context, it will end at the $, and the ¡ just after it will make the parser error. Pyth's Python literals always end at the next $, regardless of what the Python code might be doing.
If the program starts in a " context, the " will make the string end, and the final ¡ will make the parser error.

x86 32-bit machine code, 11 bytes  (and future-proof 64-bit)
90 90 90 90 90 90 90 90 90 0f 0b

This is times 9 nop / ud2.  It's basically a NOP sled, so it still runs as 0 or more nops and then ud2 to raise an exception, regardless of how many of the 0x90 bytes were consumed as operands to a preceding opcode.   Other single-byte instructions (like times 9 xchg eax, ecx) would work, too.
x86 64-bit machine code, 10 bytes (current CPUs)
There are some 1-byte illegal instructions in 64-bit mode, until some future ISA extension repurposes them as prefixes or parts of multi-byte opcodes in 64-bit mode only, separate from their meaning in 32-bit mode.  0x0e is illegal in 64-bit mode on current CPUs (tested on Intel Skylake).  It's push cs in 32-bit mode; AMD64 freed up a bunch of opcodes for future use but as of yet neither Intel nor AMD have added any 64-bit-only extension to use them.  But they still could, which is why this isn't future-proof; some future CPU could decode 0x0e as an opcode or prefix.
0e 0e 0e 0e 0e 0e 0e 0e 0e 0e

Rules interpretation for executable machine code:

The bytes can't be jumped over (like the "not parsed" restriction), because CPUs don't raise exceptions until they actually try to decode/execute (non-speculatively).

Illegal means always raises an exception, for example an illegal-instruction exception.  (Real programs can catch that with an exception handler on bare metal, or install an OS signal handler, but I think this captures the spirit of the challenge.)

It works because a shorter byte-string ending in ud2 could appear as an imm32 and/or part of the addressing mode for another instruction, or split across a pair of instructions.  It's easiest to think about this in terms of what you could put before the string to "consume" the bytes as part of an instruction, and leave something that won't fault.
I think an instruction can consume at most 9 bytes of arbitrary stuff: a SIB byte, a disp32, and an imm32.  i.e. the first 2 bytes of this instruction can consume 8 NOPs and a ud2, but not 9.
c7 84 4b 00 04 00 00 78 56 34 12        mov dword [rbx+rcx*2+0x400],0x12345678

Can't beat 9 nops:
    db 0xc7, 0x84   ; opcode + mod/rm byte: consumes 9 bytes (SIB + disp32 + imm32)
    times 9 nop          ; 1-byte xchg eax, ecx or whatever works, too
    ud2
  ----
   b:   c7 84 90 90 90 90 90 90 90 90 90        mov    DWORD PTR [rax+rdx*4-0x6f6f6f70],0x90909090
  16:   0f 0b                   ud2

64-bit mode:
 c7 84 0e 0e 0e 0e 0e 0e 0e 0e 0e        mov    DWORD PTR [rsi+rcx*1+0xe0e0e0e],0xe0e0e0e
 0e                      (bad)

But the bytes for 8 NOPs + ud2 (or times 9 db 0x0e) can appear as part of other insns:
    db 0xc7, 0x84   ; defender's opcode + mod/rm that consumes 9 bytes

    times 8 nop          ; attacker code
    ud2

    times 10 nop    ;; defenders's padding to be consumed by the 0b opcode (2nd half of ud2)
----
  18:   c7 84 90 90 90 90 90 90 90 90 0f        mov    DWORD PTR [rax+rdx*4-0x6f6f6f70],0xf909090
  23:   0b 90 90 90 90 90       or     edx,DWORD PTR [rax-0x6f6f6f70]
  29:   90                      nop
  2a:   90                      nop
  ...

The rules here weren't really clear enough for me to consider posting an asm/machine code answer. For example, why can't you just do ud2? It seems you're saying that you interpret the rules as forbidding jumping over the bytes, so ud2 would work just fine on its own, no? Oh…I guess you're saying the issue is that ud2 can appear as a prefix to a valid instruction? The second part of this answer was a little difficult for me to understand.

@CodyGray: Right, the 2 bytes that encode ud2 can appear in the imm32 of any instruction.  I was thinking about this in terms of what bytes can you put before such a string that "consume" 0f 0b as part of an earlier instruction instead of  decoding as ud2.  I wasn't totally happy with how I ended up presenting it, but I wanted to illustrate why only 8 nops wasn't enough, and what happened with 9 nops + ud2.

@CodyGray: An asm source program would be a totally different answer.  That would have to error the parser used by the assembler, not produce faulting machine-code.  So something like %else / %else might work to defeat %if 0, which can normally protect any invalid text from being parsed.  (idea from a CPP answer)

Don't quite satisfy. Your solution may be just in .data. (though it makes it impossible)

@l4m2: To make the question answerable / interesting, I had to limit it to code that's executed (and not jumped over).  See the rules interpretation bullet points in my answer.  That would also rule out static data, of course.  Because then it's not machine code at all, it's just data.  This question required more adaptation than most for a machine-code answer to make sense, because there is no compile/assemble stage where you can error the parser, we're just talking about bytes already in memory.

Shakespeare Programming Language, 2 bytes
.:

Explanation: If this string is in the title of the play, the . ends it and the : is not a valid character name. Similar problems occur in an act and scene name. No character can speak a line beginning with :, and the . will end a Recall statement, which can otherwise create a comment.

INTERCAL, 12 bytes
DOTRYAGAINDO

Try to crack it online!
INTERCAL's approach to syntax errors is a bit special. Essentially, an invalid statement won't actually error unless the program tries to execute it. In fact, the idiomatic syntax for comments is to start them with PLEASE NOTE, which really just starts a statement, declares that it isn't to be executed, and then begins it with the letter E. If your code has DODO in the middle of it, you could prepend DOABSTAINFROM(1)(1) and tack any valid statement onto the end and you'll be fine, if it's DODODO you can just bend execution around it as (1)DON'TDODODOCOMEFROM(1). Even though INTERCAL lacks string literal syntax for escaping them, there's no way to use syntax errors to create an illegal string, even exhausting every possible line number with (1)DO(2)DO...(65535)DODODO, since it seems that it's plenty possible to have duplicate line numbers with COME FROM working with any of them.
To make an illegal string, we actually need to use a perfectly valid statement: TRY AGAIN. Even if it doesn't get executed, it strictly must be the last statement in a program if it's in the program at all. 12 bytes is, to my knowledge, the shortest an illegal string can get using TRY AGAIN, because it needs to guarantee that there is a statement after it (executed or not) so DOTRYAGAIN is just normal code, and it needs to make sure that the entire statement is indeed TRY AGAIN, so TRYAGAINDO doesn't work because it can easily be turned into an ignored, normal syntax error: DON'TRYAGAINDOGIVEUP, or PLEASE DO NOT TRY TO USE TRYAGAINDO NOT THAT IT WOULD WORK. No matter what you put on either side of DOTRYAGAINDO, you'll error, with either ICL993I I GAVE UP LONG AGO, ICL079I   PROGRAMMER IS INSUFFICIENTLY POLITE, or ICL099I   PROGRAMMER IS OVERLY POLITE.

There might be a few other compile-time errors which can fire before ICL993I I GAVE UP LONG AGO.

If, while using every line label, you also COME FROM every line label, it might be a bit difficult to divert control flow around the block, but there's nothing at all stopping you from just GIVING UP!

APL and MATL and Fortran, 3 bytes

'

Newline, Quote, Newline always throws an error since block comments do not exist:

APL: unbalanced quotes
MATL: string literal not closed
Fortran: Invalid character in name

This applies to MATL too

I think this would work in Fortran too.

Also J I believe

@Jonah Nope.

Ah.  Would \n)\n'\n work for J?

@Jonah It seems so.

What is this J code?

@Fmbalbuena wdym?

Illegal J code.

@Fmbalbuena I still don't get what you're asking. Maybe we should discuss it in chat?

See J code in the comments above

@Fmbalbuena Ah, \n there stands for a line break.

Let us continue this discussion in chat.

Commodore 64 Basic, 2 bytes

B

(that's a newline followed by the letter "B").
Any line in a Commodore 64 program must begin with either a line number or a BASIC keyword, and stored programs only permit line numbers.  There are no keywords beginning with "B" (or "H", "J", "K", "Q", "X", "Y", or "Z").

If I append =0 then this just becomes an assignment statement...

@Neil, that would be a valid immediate-mode command, but not a valid program.

C#, 16 bytes

*/"
#endif<#@#>
Works because:

// comment won't work because of the new line
/* comment won't work because of the */
You can't have constants in the code alone
Adding #if false to the start won't work because of the #endif
The " closes any string literal
The <#@#> is a nameless directive so fails for T4 templates.
The new line tricks it so having / at the start won't trick the */

Each variation fails with a compilation error.

Weird that you decided to include T4 templates in your code. Isn't T4 considered a separate language?

@ArturoTorresSánchez I don't know I had never heard of them. Someone commented this didn't work when you included T4 templates so I added the fix.

Desmos, 3 bytes

\

(linefeed, backslash, linefeed)
I recently said "Pasting in invalid-formatted text [into Desmos] simply does nothing." As I recently discovered, this isn't quite true. When pasting in multiple lines, it's happy to throw errors if one of them is invalid. Now, this works even if some of those lines other are blank, causing them to be ignored. Therefore, we make a \ on its own line, which is guaranteed to throw an error.
Logically, we should be able to knock this down to two bytes (\, LF), as no legal line can end with a \. However, Desmos strangely interprets this as an empty list (normally represented as []), for reasons I don't understand. This makes that two-byte string an unusual almost-illegal string, where the only valid program containing that string is the string itself.

"However, Desmos strangely interprets this as an empty list (normally represented as [])" -- I had to test this, and it's even weirder than I thought. Desmost doesn't just interpret it as [], but renders it as [].

Not only does it parse \¶ (where ¶ is newline) as an empty list, it literally parses anything in the form [invalid expression]¶ (replace [invalid expression] with something that would normally error) as an empty list too. Try f(n)=a¶ for example.

Literate Haskell, 15 bytes
Repairing a deleted attempt by nimi.

\end{code}
5
>

Try it online!
nimi's original attempt is the last two lines, based on Literate Haskell not allowing > style literate code to be on a neighboring line to a literate comment line (5 here). It failed because it can be embedded in a comment in the alternate ("LaTeX") literate coding style:
\begin{code}
{-
5
>
-}
\end{code}

However, the \begin{code} style of Literate Haskell does not nest, neither in itself nor in {- -} multiline comments, so by putting a line with \end{code} just before the line with the 5, that workaround fails, and I don't see a different one.

Free Pascal, 18 bytes

*)}{$else}{$else}

First close all possible comments, then handle conditional compile.
Please comment here if I forgot something.

@user902383 Does your example contain the leading newline of his snippet?

@BrianJ  nope, i thought it was just formatting issue, my bad

I don't think it's possible in Free Pascal. Just put them after begin end..

@jimmy23013 but it seems that codes after the end. become valid is allowed by the question.

CJam, 7 bytes
"e#"
:"

Try it online!

Brain-Hack (a variation of Brain-Flak), 3 2 bytes
Thanks to Wheat Wizard for pointing out that Brain-Hack doesn't support comments, saving me a byte.
(}

Try it online!

How do you do comments in Brain-Flak? I don't know of any way to do those.

@EriktheOutgolfer # TIO

Huh undocumented behavior.

@EriktheOutgolfer I always assumed they were documented somewhere. I'll look at adding them.

You don't need the newline in BrainHack or Craneflak, Rain-Flak is the only one of the three versions that has line comments.  Although Craneflak parses on the fly so its impossible to solve this in Craneflak, any solution could be beaten by prepending (()){()}.

JavaScript (Node.js), 9 8 bytes
`*/
\u`~

Try it online!
I think this should be illegal enough.
Previous JS attempts in other answers

;*/\u)

By @Cows quack
As an ES5 answer this should be valid, but in ES6 wrapping the code with a pair of backticks wrecks this. As a result valid ES6 answers must involve backticks.

`
`*/}'"`\u!

By @iovoid
This is an improved version involving backticks. However a single / after the code breaks this (It becomes a template literal being multiplied by a regex, useless but syntactically valid.) @Neil made a suggestion that changing ! to ). This should theoretically work because adding / at the end no longer works (due to malformed regex.)

Explanation
`*/
\u`~

This is by itself illegal, and also blocks all single and double quotes because those quotes cannot span across lines without a \ at the end of a line
//`*/
\u`~

and
/*`*/
\u`~

Blocks comments by introducing
illegal escape sequences
``*/
\u`~

Blocks initial backtick by introducing non-terminated RegExp literal
console.log`*/
\u`~

Blocks tagged template literals by introducing an expected operator between two backticks

"Template literal... multiplied by a regex." Only in JavaScript would that be a legal expression.

Go, 6 bytes

*/```

Try to crack it online!
The grave accent (`) marks a raw string literal, inside which all characters except `, including newlines and backslashes, are interpreted literally as part of the string. Three `'s in a row are the core: adjacent string literals are invalid and ` always closes a ` string, so there's no way to make sense of them. I had to use 3 more bytes for anti-circumvention, a newline so we can't be inside a single-line comment or a normal quoted string, and a */ so we can't be inside a multi-line comment.

Jelly, 3 4 bytes
»»
€

Try it online!
Alternative 4 bytes:
»

€

+1 byte because emanresu A found an issue with the old approach
Jelly has no comments, and every line in the code is parsed whether or not it is reachable. The only way to prevent some code from being executed is by putting it in a string literal. There are different types of string literals based on the ending character, but almost all start with “. This is countered by », which terminates a string (and interprets it as a dictionary-compressed string).
The only two string literal types that do not terminate at the first » are ⁾ and ⁽, which each process precisely the next two characters. However this still leaves the newline unescaped.
Thus € (each/map) will always be executed on a link (line) of its own. It tries to get a link from its left; since none exists, the interpreter errors.

Nope

@emanresuA fixed

Google Sheets, Excel; 3 bytes
For a single-cell Formula (starts with + or =). Otherwise, you can just put whatever arbitrary text you want into a cell.
Here it is: 1"1

A string has to be enclosed in "s. A double quote must be escaped by "".
The " has to be a string token boundary.
If it's the end, following a string with a 1 is illegal.
If it's the beginning, preceding a string with a 1 is also illegal.

Swift,  4  3 bytes
There's control characters in here, so I'll just give their ASCII values: 0A 22 00.
Most of the ways that other C-family languages do this don't work in Swift, because Swift allows nested block comments.
The null character always generates at least a warning. However, if it's in the middle of whitespace or a line comment, it's only a warning, not an error. Additionally, Xcode lets you put most control characters inside of a block comment and just rolls with it.
Emphasis on most. For some reason, if you have a null byte in the middle of a block comment or string literal, the Swift compiler gets lost and can't find the end, no matter where it is. This causes an error (and also breaks Xcode's syntax highlighting).
So, this is three bytes:

0A -- a newline, to make sure we're not in a line comment or single-line string literal.
22 -- ", the start of a single-line string literal, unless it's inside a multi-line string literal or block comment. This does not end a multi-line string literal if it started inside of one.
00 -- a null byte, to prevent the block comment or string literal from terminating.

The original answer used /* (open block comment) rather than ".

AWK, 4 bytes

/

Try it online!
Since AWK doesn't have a method to do multi-line comments, need 2 newlines before and 1 after / to prevent commenting out or turning this into a regex, e.g. add 1/. The most common message being `unexpected newline or end of string.
With previous crack

I enjoyed this.

Thanks. I enjoyed coming up with it :)

VBA, 2 Bytes
A linefeed followed by an underscore - the _ functions as the line continuation character in VBA, and as there is nothing in the line directly to the left or above the line continuation, coupled with VBA's lack of multiline comments means that this will always throw the compile time error Compile Error: Invalid character

_

You do depend on your pattern starting on a new line... so, add a newline.

@Deduplicator it already has a new line, - it does not matter what follows the _, only that there is no valid line to the left or above it

What if it is embedded like this: myfunction( \n_ )?

@Deduplicator the line continuation character must be on the same line as it is continuing ie Public Function Foo( ByVal bar as Integer, _  (new line) bas as long) as double - so yes, it would result in an error if you called the function you described

Ok, in that case it's more like myfunction( _ \n_ ). Sorry for the confusion. To put it another way, you should have used two newlines.

@Deduplicator I am not sue what you mean. There is no way to escape a newline (or any character) in VBA so it should not be necessary to add a newline before, and appending literally anything to the end of this VBA code will cause the illegal character error - eg \n_"test", \n_12321 ,  \n_#if,  \n__ and \n_\n will all result in the the error as will all of the above with any prepended code

so, myfunction(_ (newline) _ (newline) ) would be an error?

Yes, that would cause an error. example test code function myfunction(  _\n_ (slightly changed from your example as you cannot have a _ directly following a ( or any other character  - I believe that this is why this works in VBA) - of note is that function myfunction(  _\n _... would be valid (note the added space)

In VBA, every string is illegal and results in an error...

@MegaMan I am not sure what you mean ... I'll just take that as a joke

JavaScript, 11 characters
`
`*/}'"`\u)

The backticks make sure to kill template strings, the quotes get rid of strings, the newline avoid commented lines, the end of comment avoids block comments, and the last backtick and escape (with a ) to avoid appending numbers or /) try to start a invalid string.
Try it online!

TI-Basic (83+/84+/SE, 24500 bytes)
A

(24500 times)
TI(-83+/84+/SE)-Basic does syntax checking only on statements that it reaches, so even 5000 End statements in a row can be skipped with a Return. This, in contrast, cannot fit into the RAM of a TI-83+/84+/SE, so no program can contain this string. Being a bit conservative with the character count here.
The original TI-83 has 27000 bytes of RAM, so you'll need 27500 As in that case.
TI-Basic (89/Ti/92+/V200, 3 bytes)
"

Newline, quote, newline. The newline closes any comments (and disallows embedding the illegal character in a string, since AFAIK multiline string constants are not allowed), the other newline disallows closing the string, and the quote gives a syntax error.
You can get to 2 bytes with
±

without the newline, but I'm not sure whether this counts because ± is valid only in string constants.

Done, thanks :)

SmileBASIC, 2 bytes

!

Nothing continues past the end of a line, so all you need is a line break followed by something which can't be the start of a statement. ! is the logical not operator, but you aren't allowed to ignore the result of an expression, so even something like !10 would be invalid (while X=!10 works, of course)
Similar things will work in any language where everything ends at the end of a line, as long as it parses the code before executing it.
There are a lot of alternative characters that could be used here, so I think it would be more interesting to list the ones that COULD be valid.
@ is the start of a label, for example, @DATA; ( could be part of an expression like (X)=1 which is allowed for some reason; any letter or _ could be a variable name X=1, function call LOCATE 10,2, or keyword WHILE 1; ' is a comment; and ? is short for PRINT.

oh, for some reason when I edited the post it was duplicated...

Rockstar, 4 5 bytes
Crossed out 4 is still 4 :(
)
"""

Rockstar is a very... wordy language.
While " can be used to define a string, such as Put "Hello" into myVar, to my knowledge there is no way for 3 quotes to appear outside of a comment, and the close paren ensures that won't happen either (Comments in Rockstar are enclosed in parentheses, like this).
Rockstar also has a poetic literal syntax, in which punctuation is ignored, so the newline makes sure that the 3 quotes are the start of a line of code, which should always be invalid

What about (()"""), wouldn't that be a no-op?

@BMO first paren opens a comment, 2nd paren does nothing because it's commented, 3rd paren closes the comment, then you have """) being parsed as code, which is invalid

Hmm, nested comments are not in the specs. Comments seem to be discouraged anyways. But you oversaw poetic string literals which allow any string, so Goethe says )""" is valid.

@BMO good point, can be fixed by inserting a newline inbetween ) and """

Ruby, 58 23 27 bytes AND proof of impossibility at bottom
This snippet is valid in any Ruby version prior to Ruby 2.3 (when heredocs were added):

=end
)}end/;[}'"\//;[}#{]}

Old version (invalid):

=end
)}end/;kill(Process.pid,-9)'"\//;kill Process.pid,-9

This cannot be used anywhere in a Ruby program except after __END__.
Proof of impossibility
This solution is impossible in any Ruby version after and including Ruby 2.3.
Any Ruby solution can be inserted into this snippet and function as a valid program:
<<'string'

# Insert code here

string

With this particular snippet, you can add (note leading newline)

string

to your solution in order to invalidate the program. However, changing the "name" of the heredoc will again invalidate your solution. Heredocs can have infinite placeholders, meaning a solution accounting for all of them would be infinitely long. Thus an answer in Ruby 2.3+ is impossible.
Thanks to histocrat for pointing this out.

Invalid, cannot appear. Needing a kill command means it can be put in a program that still runs

Can kill be redefined to not work properly?  For example define kill to do nothing with the input?

@ASCII-only--yes, that's true. I thought that the question was to raise an error, not disallow a valid program. Sorry about that. Will remove.

Not quite--If you put single quotes around the heredoc terminator like so, it won't interpolate with #{. I don't think this is solvable in Ruby due to this feature.

@histocrat I was wondering how long it would take for someone to notice! Congrats, I guess.

Invalid answers need to be deleted.

Proof of impossibility is still a valid answer. Though I think the proof might need to be a little more strict

Updated solution to reflect impossibility in Ruby 2.3+.
@JoKing The proof depends on allowing infinitely long answers or not. I'm too lazy to check atm whether infinitely long answers are allowed; but if they are, then I can add one to this answer

JavaScript, 7 bytes
 */
#`#

Adding a // at the beginning will still not work because of the leading newline, leaving the second line uncommented.

Adding a /* will not uncomment the string completely because of the closing */ that completes it, leaving the # exposed.

Adding ` will not quote the string completely, because of ` that completes a string, leaving the # exposed.

Regular expressions won't work because of # following / character.

/ following * cannot be parsed as a regular expression, as regular expressions cannot have newlines

Try it!

clicky.onclick=a=>{console.clear();console.log(eval(before.value+" */\n#`#"+after.value));}
textarea {
  font-family: monospace;
}
<button onclick="console.clear();">Clear console</button>

<textarea id=before placeholder="before string"></textarea>

 */
#`#

<textarea id=after placeholder="after string"></textarea>

<button id=clicky>Evaluate</button>

Scratch (1.x, except 1.2 beta), scratchblocks syntax, 26 bytes

when gf clicked
say(()/()

Leading new line ensures that "when gf clicked" will not be in a comment, so that what's below it will run.
This errors when run in the Stage, because the Stage cannot use the say block.
This errors when run in a sprite by itself, because a divide by zero is attempted. (When a number argument is blank, it is read as 0.)
This errors when run in a sprite when ) or a new line is added after it, because it doesn't change what the existing code does.
This errors when run in a sprite when something else is added after it, because it creates an undefined block which causes an error when run.

1.2 beta is excluded because it featured comment blocks (different from modern comments), which supported multiline, which this could be put into.
Versions past 1.4, including the Experimental Viewer, are excluded because dividing by zero does not cause an error.

Dis, 2 bytes.
))

How it works

( to the nearest ) is a comment.
But nothing can match the second ) above in this syntax.
Thus it is syntax error.

What about (())? Does Dis not support parentheses inside comments?

@mayube Comments may be used, enclosed in parentheses. They can't be nested.

Pip Classic, 10 bytes

;\"
;`
*;

Try it online!
I think this should be solid, but I welcome anyone to prove me wrong.
How?
A semicolon at the start of a line begins a single-line comment, so our code is effectively
*;

and Pip complains because * is a binary operator and needs a left operand.
If we add any expression before the snippet, we still get an error because * needs a right operand. No operand can be supplied because * is followed by the expression terminator ;.
We can't wrap the snippet in a string, because every possible string delimiter (", \", and `) is matched by a delimiter in the snippet. (In a regular "-delimited string, the backslash is not an escape character, so it doesn't mess anything up.)
Finally, we can't comment out the last line of the snippet because Pip Classic doesn't have block comments.

Knight, 7 bytes
Technically, knight programs aren't allowed to contain anything outside of \r, \n ,\t, or <space>-~, so you could just submit <NUL> for a one byte solution.
Additionally, each knight program is exactly a single expression; handling things after that experssion is up to the implementation. So, you could prefix any program with TRUE—a valid expression—after which anythign afterwards would be undefined behaviour. However, that kind of defeats the spirit of the question as well IMO, so let's assume that we're actually in some arbitrary expression:
#"'#'
$

The idea is since $ is not a legal function, it cannot appear outside of strings.

If there's no leading code, then the comment removes the rest of the first line.
If we're embedded in a comment, our entire first line will be commented out, leaivng a lone $, which is illegal.
If we're inside a " string, then the first " will close it, which is then followed by the legal '#' string
If we're inside a ' string, then the first ' will close it, with the remaining ' being commented out by the #, leaving $ by itself.

Each character needs to be admissible on it's own according to the challenge rules so the the 1 byte solutions are not admissible anyway

Fortran, 14 bytes

end program
e

No multiline comments or preprocessor directives in Fortran.

Is there a good way to test this online? Also, which version/compiler of Fortran?

Scratch (scratchblocks2), 3 bytes
There's no such thing as an error in scratchblocks2 - just red-colored blocks - but this can't be expressed in actual Scratch, so I think it's OK.

<?
Leading newline to avoid this just being commented or ::ed out.
Then a predicate block with it's label starting with ? - there's no such block.

Can't test it (I'm not going to install scratchblocks2), but I don't see why say [\n<?] breaks. The [] seem to support parsing \n (like for drop-down menus).

There's a leading newline.

I think define\n<? defines the <?> block as a custom block, here

Powershell, 10 8 12 14 13 14 16 bytes
-2 byte thanks to Mazzy finding a better way to break it
+4 -1 bytes thanks to IsItGreyOrGray
$#>
'@';
"@";
@=

I hope this works. ' and " to guard against quotes, #> to break the block-comment, new lines to stop the single-line comment, both '@ and "@ to catch another style of strings, and then starts an improper array to throw a syntax error.
The logic being they can't use either set of quotes to get in, they can't block-comment it out, If @" is used, it'll create a here-string which can't have a token afterwards, and if they leave it alone, it'll try to make a broken array. This statement wants to live so hard, I keep finding even more holes in the armor.

Smart! What about this  '"#>\n@{= : protectors + @{=

Or protectors + @=

Cool! It may also be worth looking in the direction LFCR (reverse of CRLF), EOF and other control chars.

Embedding in $( ') makes it legal
$(
#>
'@
"@"
@=
')

@IsItGreyOrGray AAAAAAAAAAAw heck.

It looks like changing #> to $#> will break it as "not recognized as the name of a cmdlet..." It might be made legal again somehow, but I don't have a way. Yet. :)

Sorry... Embed between write-host ' and '@

@IsItGreyOrGray Sonofagun. Now featuring semi-colon armor?

Nice! I've got nothing. Everything I've tried has failed.

PCRE Regex, 6 7 bytes
\E
)](+

Try it on regex101
Any string not containing \E would be legal inside a \Q...\E literal sequence. By starting this one with \E, we break out of such a sequence if we were in one. And if we weren't in one, but are preceded by a \, then it will be treated as a literal \E, and we'll still be guaranteed not to be inside a \Q...\E.
(+ is not part of any legal group structure, and will generate a compile-time error ("Incomplete group structure" and/or "The preceding token is not quantifiable" / "quantifier does not follow a repeatable item") anywhere other than:

Within a \Q...\E. We've handled this. We can't be inside one thanks to the \E.
Immediately after a \. But since we have it immediately after a \E, it can't be immediately after a \. Note that \E alone is valid, even if there was no \Q before it.
Inside a #... style comment. This can only happen in free-spacing mode, but this can be turned on by (?x) anywhere in a regex, so we need to handle it.
Inside a (?#...) style comment.
Inside a character class, e.g. [(+] or [\Q\E(+] – or even [\Q\E](+], which will be treated as [](+], which, since an empty character class is not part of PCRE syntax (except in PCRE2 with the PCRE2_ALLOW_EMPTY_CLASS option enabled), is treated as a character class consisting of ](+ (the beginning of a character class is the only place where ] does not need to be escaped).

Because of #3, we need a newline, to break out of any #... comment we may be in.
Because of #4, we need a ), to break out of any (?#...) comment we may be in.
And it is because of #5 that we need to put ] in front of the (+. This closes any character class we might have been in. If we hadn't already put a newline and/or a ) to close a potential comment, we'd need this to be ]], because a character class can't be empty and ] is allowed to be the first character in a class without being escaped. In any case, thanks to having a character before our ], it even works if a range was started, e.g. [!-\E)](+.
Edit: Silly me, didn't protect it from being inside comments. Fixed.

ECMAScript Regex, 4 bytes
]](+

Try it on regex101
This is a quite a bit easier than PCRE. There's no \Q...\E, no free-spacing mode, and no comments. But if we used just ](+ we could still be inside a character class and have our ] escaped, as [\](+] which would be treated as a character class of ](+. So we still need the double ] to make sure we exit any character class we may have been in, which works even if a range was started, e.g. [!-]](+.
(+ is illegal in any context other than a character class, and will give an error message such as "Nothing to repeat" or "Incomplete group structure" / "The preceding token is not quantifiable".

Runic Enchantments, 3 bytes
Ṷ

One of many possible variations.
Try it online!
Runic utilizes unicode combining characters in a "M modifies the behavior of C" (where C is a command). As such, no two modifiers are allowed to modify the same command and the parser will throw an error if such an occurrence is found.
Similarly, certain commands that redirect the IP cannot be modified in any way, due to the existence of direction modifying modifier characters (and both in the same cell makes no sense).
There is no way to escape or literal-ize the string to make it valid. Tio link contains a ; in order to bypass the higher-priority "no terminator" error.

NDBall 2 bytes
specificly in NDBallSim V1.0.1
##

a hashtag is a memory cell instructor and requires a direction, two of them anywhere will cause the error
NDBall Parse ERROR @ LINE (whatever line): Memory cell requires a direction ex: #>12

this double character trick can actually be done with many more chars, to be exact all of these )(,}{|><+-pP$%Y][E and newline
This is actually all (discounting digits) of the useable chars in the lang itself because it never has a case where you use the same char twice

C#, 6 bytes

"*/#

# is only used in C# to specify a preprocessor directive. Preprocessor directives are only valid if the # is the first non-whitespace character on its line. As a result, it doesn't even matter if the specified directive exists or not (so the shortest solution is to not specify any directive name).
The only way to prevent # being interpreted as a directive is to put it in a comment or string.
It is not possible to comment out # because // is prevented by preceeding newline and /* is prevented by */. It is not possible to enclose it in a string because multiline strings must start with @", but there is no way to put @ in front of a string that would capture # (@\n" is not valid).

Grass, 3 bytes
wWv

Try it online!
Grass programs are written using only w, W, and v; all other characters are ignored.
w is necessary because any characters placed before the program's first w are ignored.
W is expected to be followed by a sequence of w characters to form a function application; however, it is instead followed by a v, which causes a parse error.

S.I.L.O.S, 4 bytes
Silos is competitive \o/

x+

S.I.L.O.S runs on a two pass interpreter / compiler. Before execution a "compiler" attempts to simplify the source into an array describing the sourc Each line is treated separately. x+a is an assignment operator that will add ea to the value of x and store it into x. However the "compiler" will break. Therefore, we take this string and add a new line before and after ensuring it's on its own line and breaks the compiler.
Try it online!

Why doesn't ax+ error out?

undefined compiler behavior @EriktheOutgolfer

AutoHotkey, 5 bytes
` is the escape character. You can only escape a " when assigning it to a variable.
\n*/ prevents it from being commented out or assigned to a variable.

*/`"

Husk1, 3 bytes

◊

Try it online!
Explanation
The newlines force ◊ to be parsed as a supposed built-in, however since it's not (yet) implemented the parsing fails with unexpected "\9674" or an error because of empty lines.
Note: Initially I tried to force an inference failure, but the type-checking is done lazily and one can easily "un-break" programs with adding a valid main function.

1: The code might work at some point in the future. So to be precise any version of Husk as of before the date of this post (ie. at least up to commit 0806b9d).

An inference failure would have been fun, but this is probably shorter than that would be anyhow.

Keg, 3 4 bytes
Fixed a for loop bug noted by @Jono2906

)ø.

Try it online!
Explanation
\n    Terminate a line-comment
)     End a for loop
 ø    Clear the stack
  .   Try to print the TOS item, which will create an error to the program.

3 bytes using strings

But this is valid.

Unreadable, 2 bytes
''

Try it online!
All Unreadable commands must be of the form '""…", with one '  followed by 1 to 10 "s. Having two successive 's anywhere in the program leads to error: parser failed: invalid command (0): '.

Lean Mean Bean Machine, 8 bytes
OO
0/
&

Try it online!
Begins with a leading newline.
Unfortunately this is basically an entire invalid program, but it can be inserted into larger programs, and there's no way to my knowledge to prevent the runtime error.
LMBM creates a 'marble' (aka instruction pointer) at every O in the code, and there is no way to prevent this (which now that I think about it causes some issues if you need an O in a string). & is the division operator in LMBM.
In short, this snippet causes a ZeroDivisionError: division by zero runtime error.

Needs a leading newline, otherwise you can just add some dummy leading characters so that the marbles dont land in the division by zero

@thejonymyster good catch!

Add++, 6 3 bytes

";

Try it online!

This can be commented out

@Mayube Fixed. Thx.

Add++ doesn't seem to support multi-line strings or comments so 2 bytes

@Mayube Nope Try it online!

Chicken, 2 bytes
ih

Thanks to jimmy23013

Can you make comments in Chicken?

@BgilMidol Nope

Every individual character in your submission must be admissible in a legal program; that is, you can't just use a character which is always rejected. So maybe ih is better.

@jimmy23013 okay

PowerPC for XBox 360, 19 bytes
~
J,e~
J,e~
J,e~
J,

The operative sequence is ~␊J,, in which the linefeed may be replaced with any byte less than 32 and the J with any byte congruent to 2 mod 8.
If this sequence appears on a four-byte boundary (which it will, in the above  string) on an executable page, it codes an xdcbt (prefetch to L1 cache, skipping L2); any (even speculative) jump to it will then break cache coherency, probably leading to a crash soon after. Since the branch predictor even predicts computed jump destinations, this will happen sooner or later, see here.
I wish I had been able to force an all-printable version, but LF is pretty close.

Pyt, 2 bytes
ɬĹ

Just one amongst many.
Try it online!
It's pretty simple, actually:
Pyt has no comment markers, so every valid character when using Pyt's proprietary encoding (not UTF-8) does something.
ɬ pushes the string "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
Ĺ returns the least common multiple of the top two elements on the stack
You can replace ɬ with either ɫ or ʊ (only the lowercase and uppercase letters, respectively), and you can replace Ĺ with the vast majority of the functions in Pyt, as most of them only work on numbers.
There is another 2-byte family of solutions:
do

where d is any digit (0-9), and o is either ҏ or Ƒ.
ҏ palindromizes a string or array and does not work on numbers, and Ƒ flattens the array at the top of the stack, but errors if the top of the stack isn't an array.
And there is a singleton (not in a family of solutions):
ɔŕ

ɔ clears the stack, and then ŕ pops the top of the stack (and errors out if it is empty).

Perl, 12 bytes 25 bytes
Tried to cut all strings. Not really short.

.
"'/%+)}]>#
=pod
=cut
.

First newline to exit comments (there are no multiline comments)
then . in first column to exit format sections
end strings (there are strings like "...", '...' and like qw/.../ but instead of '/' other chars can be used
start a POD section (=pod at the beginning of the line)
end the POD section (=cut at the beginning of the line)
. is not in any comment and is invalid.

After __DATA__ or __END__ there is no code. There starts a data section.
Hope this is correct (my first step on code golf ...)

Unfortunately this doesn't work: https://ato.pxeger.com/run?1=m72kILUoZ8GCpaUlaboWN9VzKxVUKhRsFZS4uGwL8lO4bJNLS7j0uJSsuQqKMvNKFJQyUnNy8pUgyqG6YLoB

@pxeger Thanks! I have to exit all types of strings first...

Welcome to Code Golf!

Also, this challenge is impossible in Perl due to __END__

@emanresuA - I don't think so, because all after __END__ or __DATA__ isn't code.

Ly, 6 bytes

\""{)

(note the leading newline)
The newline prevents line comments, Ly doesn't have block comments, the \"" ensures that all open string literals will close, and the unmatched brackets raise the error.

Gaia, 3 bytes

#“

Try it online!
Each line in Gaia is a separate function, so the newline ensures that the code starts at the beginning of a function. Even putting a newline in a string literal will start a new function, since Gaia allows omitting closing quotes. In addition, all functions are parsed before execution, so adding additional functions below won't help.
The # is a meta, which has to directly follow an operator. At the start of the function, there is no operator, so it's a syntax error.
The “ is an opening quote for string literals. It's there because Gaia also allows omitting the opening quote of strings at the start of a function. If this opening quote wasn't here, you could write #” which is entirely legal.

FRACTRAN, 2 bytes
()

Try it online!
Since FRACTRAN doesn't have any way of including comments or literals (AFAICT), this will always error any valid program, since all valid programs must be a valid fraction, and this string can never be part of a valid fraction.

Ink, 5 bytes

*/{}
Leading newline ends single-line comments.
*/ ends multi-line comments. Thanks to the leading newline, you can't put a / in front of it to make it the start of a comment rather than the end of one.
{ and } enclose things meant to be parsed, rather than simply printed. If there's nothing between them, the compiler gets sad because it Expected some kind of logic, conditional or sequence within braces: { ... } but saw '}'. This happens even inside string literals, so there's no need to check if we're inside one of those.

Turing Machine Code 5 bytes
Assuming block editing isn't allowed:
0

Or with the symbols showing:
< cr >< lf >
0
< cr >< lf >

Without block editing, it is impossible to stick this behind the comment symbol (';'), as the '0' will end up on the next line anyway. There is no block commenting in Turing Machine Code, a fact that is taken advantage of in other answers here as well. This patch of code would not only not run, it would kill the whole program before it can begin to execute, no matter where it is placed.
Try it online!

Milky Way, 2 bytes
Tries to execute an undefined opcode. Milky Way does not have comments. The newline is for ending strings.

)

Try it online!

Zig 0.6.0, 2 bytes

`

(\n`)
A newline will reset the tokenizer state, escaping any comments or multiline strings and erroring for single line strings. Backticks are not a valid character except in strings.
Try it online!

KonamiCode, 3 bytes
]()
Explanation:
First, the ] closes any comments this string might be placed in. Then, the () attempts to pass an empty number to the comment closing sign. Using the pynami interpreter, this will always result in an "This command doesn't have a parameter!" error, even if you put it inside a comment.


text:
Round like a Zero
Goal
Given an input number, round it off to the nearest number with one significant figure.
Requirements
Input

A floating point number.
Assume the input number results in an output within the data type's limits (ie. ignore overflow errors.)
0 is an invalid input.
Numbers that cannot be accurately represented in the floating point data type (eg. "0.35" being stored as 0.3499999) do not have to be supported.

Output

The nearest number that consists of one non-zero digit and any number of zero digits.
The result must support negative numbers and fractional numbers.
When the input lies exactly between two possible outputs, round away from zero.

Presentation
The focus is on the calculation rather than the presentation.  The output may be a floating point data type.  It may be text either in full or in scientific notation.  If you find a loophole where presenting a certain way reduces your byte count, kudos to you!
Examples
9
-3000
.2
0.2
-.2
7e12
5e-15
1e0

Test Cases
Input     Output
1         1
10        10
17        20
99        100
54321     50000
56789     60000
-123      -100
-789      -800
0.23      0.2
0.25      0.3
-0.25     -0.3
4.56e23   5e23
4.56e-23  5e-23

Scoring
The code with the least byte-count after one week wins.

I think "one significant figure" is the phrase you're looking for.

@SteveBennett, agreed.  High school science was too long ago.

The rounding rule for 0 is pretty weird.

@xnor, you're right.  0 is closer to 0.0001 than 1.  I think 0 should simply be invalid.

Yeah, and it doesn't match the goal statement.

Can we output trailing zeros after decimal i.e. -800.0 instead of -800?

@officialaimm, yes.  Presentation is not important.

Darn, Negative numbers screw over my solution.

Duplicate of https://codegolf.stackexchange.com/questions/93547/round-to-n-sig-figs ?

@Neil Hmm...I don't think this prohibits output ending in .0 like that one does.

@officialaimm I would think not. -800 has one significant figure, but -800.0 has four.

MATL, 3 bytes
1&V

Try it online! Or verify all test cases.
Test case 0.25 fails for the compiler running in Octave on TIO, but works in Matlab on Windows:

The different behaviour is caused by Octave's/Matlab's sprintf function using either "banker's rounding" or ".5 away from zero" rounding, depending on platform. More information and tests can be found here.

For 6 bytes,
1t3$Yo

works both on Octave and on Matlab. Verify all test cases.

"banker's rounding" is pretty much what made me delete my Jelly answer. >_<

@EriktheOutgolfer Yes, I figured out that was the reason too. I'm lucky that Matlab doesn't do that :-D

C# (.NET Core), 19 12 bytes
n=>$"{n:G1}"

Try it online!
Examples:
Input     Output
----------------
 54321     5E+04
-56789    -6E+04
 99        1E+02
 0.23      0.2
 0.25      0.3
-0.25     -0.3
 4.56e23   5E+23
 4.56e-23  5E-23

With the new versions of C# we also got shorter ways to achieve this, as Calculuswhiz wisely noted in the comments.

Shorter way to format: n=>$"{n:G1}"

Javascript, 19 bytes
x=>x.toPrecision(1)

This doesn’t satisfy the specification on 0 or 25.

Interesting. The spec for 0 doesn't make sense to me. But the 0.35 thing...looks like Javascript is trying to avoid bias in rounding, but the spec wants the bias.

Hey, you changed your comment - you wrote 0.35 not 25 before. I think it does satisfy the spec for 25 - it returns "3e+1" which seems right to me.

Sorry, I changed it from 0.35 because 0.35 has no exact floating-point representation. The behavior must be browser-dependent; I get 25 ↦ 2e+1 in Firefox.

Yup, I get those two different results in Chrome vs Firefox. Wow.

Not sure what to do about the 0.35 thing then? The spec says the input is "a floating point number". So it's necessarily language dependent whether "the input lies exactly between two possible outputs"?

My interpretation would be that “0.35” represents a floating-point number that’s slightly less than the mathematical value 35/100, so it’s fine to round it down. Now that the awful specification for 0 has been edited out, this answer seems fine if you label it “JavaScript (Chrome)”, unless I’m missing something else.

I'll accept that floating point is an imperfect system.  The input is a floating point data type, and the data type cannot represent 0.35, so it's an impossible input in this circumstance.

Maybe if I wait long enough every possible input will be ruled invalid... :)

Retina, 63 62 bytes
1`[1-9]
$*#
#\.?[5-9]
#$&
T`d`0`#[\d.]+
0(\.?)#{10}
1$1
#+
$.0

Try it online!

Apparently you don't have to worry about trailing zeros so you can remove the last stage completely (although I'm impressed by it, it's not every day you see three question marks in the space of four characters).

Unfortunately this answer appears to fail for 0.99.

Also fails for 0.099 etc. My attempt at a fix: Try it online!

Also fails for 99.99, 100.001, ...

Still wrong for 0.099, sorry. On the bright side I think you can remove the + after the ; on the third line.

New algorithm + more test cases. Should catch everything now

You'd think so, but this actually fails for the existing test case 4.56e27, as well as also other cases such as 1.11e99.

Man I really shouldn't do Retina before I sleep (or, for that matter, use a string-based language for  a math problem)

Don't worry, I'm still impressed... my attempt was over 100 bytes!

Perhaps you should go to sleep, and not worry about fixing 0.5 until you're less tired?

@Neil 0.5 looks good for me. Try it online

No, 0.5 should be unchanged...

PHP, 45 bytes
<?=round($x=$argv[1],-floor(log10(abs($x))));

Try it online!
Same method as my python 2 answer.
Also seems to correctly handle 0.35, which puts it a peg above the JS answer too :D

Interestingly, I think your deleted Python 3 answer may work in Python 2.

Tested, and it does! Edited and undeleted the python answer now

T-SQL, 27 bytes
SELECT FORMAT(i,'G1')FROM t

Using the same .Net formatting code as Carlos Alejo's C# answer. Input is from float column i in pre-existing table t, per our IO standards
Test cases:
Input         Output
------------ --------
1             1
10            1E+01
17            2E+01
99            1E+02
54321         5E+04
56789         6E+04
-123         -1E+02
-789         -8E+02
0.23          0.2
0.25          0.3
-0.25        -0.3
4.56E+23      5E+23
4.56E-23      5E-23

(Pretty handy that I can pre-load the input table with all these values and run them at once.)

Excel 2016, 36

Input A1.
A2: =10^INT(LOG10(ABS(A1
Result: =A2*ROUND(A1/A2,

Python 2, 62 bytes
lambda x:round(x,-int(floor(log10(abs(x)))))
from math import*

Try it online!
Not used to python golfing, but this works.
Fails on 0.35 due to floating point inaccuracies.
Thanks to Anders Kaseorg for pointing out that this works correctly in Python 2

The output for 0.25 is supposed to be 0.3.

@AndersKaseorg I'm not sure why, but I can only assume it's due to the same floating-point inaccuracies as the Javascript answer.

Hmm wait 25 has the same problem... weird.

For anyone wondering, Python 2's round rounds away from zero while Python 3 rounds to even, that's why this works in Py2 but not 3.

you can golf few bytes using log(x,10) instead of log10(abs(x)).

@AlixEisenhardt Apparently not

Oh, my bad. Is seems that it's not working with negative inputs.

Guile, 23 bytes
(format #t"~,0e"(read))

Try it online!

Perl 5, 15 bytes
printf"%.1g",<>

Try it online!

Zsh, 14 bytes
Port of the perl answer. Try it Online!
printf %.1g $1

Forth (gforth), 24 bytes
: f 1 set-precision f. ;

Try it online!
Input is expected on the floating point stack. Output is to stdout
I don't like making changes to the global (for this instance) precision of the floating point output functions, but it saves a lot of bytes to not have to restore the previous value at the end. Does not output in engineering or scientific notation, regardless of input.
Note: For some reason, the tio interpreter converts 0.25 to 0.2, while my local installation converts 0.25 to 0.3. I'm not entirely sure why this is, but since I get the correct result locally, I'm leaving my answer as-is
: f                   \ start a new word definition
  1 set-precision     \ set the floating point output words to use 1 significant digit
  f.                  \ output the top of the floating point stack
;                     \ end the word definition

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
ANNNOUNNNCCCEEERRR VOICCCEEE
Write a function that takes a string of letters and spaces (no need to handle non-letters) and performs the ANNOUNCER VOICE translation algorithm as follows:

First, uppercase everything.
For each word,

Elongate each consonant cluster by tripling each letter; except, if the word begins with a consonant cluster, do not elongate that cluster. For example, other should become OTTTHHHEEERRR but mother should become MOTTTHHHEEERRR.
Elongate the final vowel by tripling it.

In both cases of elongation, if you're tripling a letter, first coalesce it with duplicate letters on either side. For example, hill should become HIIILLL and bookkeeper should become BOOKKKEEPPPEEERRR.
For the purposes of this challenge, y counts as a consonant.
Clarification/simplification: You may assume that each pair of words is separated by a single space, and that the input contains no consecutive spaces, and that the input will not be the empty string.
Shortest code wins!

Test vectors:
> sunday sunday
SUNNNDDDAAAYYY SUNNNDDDAAAYYY
> mia hamm
MIAAA HAAAMMM
> chester alan arthur
CHESSSTTTEEERRR ALLLAAANNN ARRRTTTHHHUUURRR
> attention please
ATTTENNNTTTIOOONNN PLEASSSEEE
> supercalifragilisticexpialidocious
SUPPPERRRCCCALLLIFFFRRRAGGGILLLISSSTTTICCCEXXXPPPIALLLIDDDOCCCIOUUUSSS
> moo
MOOO
> Aachen
AACCCHHHEEENNN
> Oooh
OOOHHH
> grifffest
GRIFFFEEESSSTTT
> k
K
> aaaabbbbc
AAAABBBBCCC

Here's a reference implementation which I would move to an answer except that as of this morning the question's been closed. :P
import itertools,re
def j(s):return re.match('^[AEIOU]+$',s)
def c(s):return ''.join(sum(([h,h,h]for h in[k for k,g in itertools.groupby(s)]),[]))
def v(s):
 while len(s)>=2 and s[-2]==s[-1]:s=s[:-1]
 return s+s[-1]+s[-1]
def a(n):
 r=''
 for w in n.split():
  if r:r+=' '
  ss=re.split('([AEIOU]+)', w.upper())
  for i,s in enumerate(ss):
   r += [v(s),s][any(j(t) for t in ss[i+1:])]if j(s)else[s,c(s)][i>0]
 return r
while 1:print a(raw_input('> '))

A request for the future: please avoid words and phrases like consonant cluster, coalesce, and elongation. A non-native English speaker like myself might need a dictionary to understand your post.

It should be the vowels that are "elongated" :(

What is consonant cluster?

APL (Dyalog), 175 bytes
1↓' +'⎕R' '⊢'[AEIOU][^AEIOU]+ '⎕R{m/⍨1,3×2≠/m←⍵.Match}'([AEIOU])\1*([^AEIOU]*? )' ' [AEIOU]' ' [^ AEIOU]+' '([^AEIOU ])\1*'⎕R'\1\1\1\2' '&' '&' '\1\1\1'⊢'$| |^'⎕R'  '⊢1(819⌶)⍞

Try it online!
⍞ prompt for character input
1(819⌶) convert to uppercase (819 ≈ Big)
⊢ pass the result further (serves to separate the strings and the 1)
'$| |^'⎕R'  ' Replace:
 the end, any space, and the beginning
 → two spaces
⊢ pass the result further (serves to separate two groups of strings)
'([AEIOU])\1*([^AEIOU]*? )' ' [AEIOU]' ' [^ AEIOU]+' '([^AEIOU ])\1*'⎕R'\1\1\1\2' '&' '&' '\1\1\1' Replace:
 any number of identical vowels and any number of non-vowels and a space
 → the vowel thrice and the unmodified consonants
 a space and a vowel
 → themselves
 a space and a consonant cluster
 → themselves
 a run of identical consonants
 → three of those vowels
'[AEIOU][^AEIOU]+ '⎕R{…} Replace:
 a run of non-vowels and a space
 → the result of the following anonymous function with the namespace ⍵ as argument:
  ⍵.Match the text that was found
  m← assign that to m
  2≠/ pair-wise different-from
  3× multiply by three
  1, prepend one
  m/⍨ use that to replicate m
⊢ pass the result further (serves to separate two strings)
' +'⎕R' ' Replace:
 one or more spaces
 → with a single space
1↓ drop the initial letter (a space)

Does this work? 1↓' +'⎕R' '⊢'[AEIOU][^AEIOU]+ '⎕R{m/⍨1,3×2≠/m←⍵.Match}'([AEIOU])\1*([^AEIOU]*? )' ' [AEIOU]' ' [^ AEIOU]+' '([^AEIOU ])\1*'⎕R(s,'\2')'&' '&'(s←6⍴'\1')⊢'$| |^'⎕R'  '⊢1(819⌶)⍞

^ Saves two bytes if it works ^

APL, 90 bytes
{1↓∊{s←{⍵⊂⍨1,2≠/⍵}⋄x↑⍨¨(3⌈≢¨s⍵)⌊≢¨x←s⍵/⍨(1+2×{⌽<\⌽⍵}∨~∧∨\)⍵∊'AEIOU'}¨w⊂⍨w=⊃w←' ',1(819⌶)⍵}

Explanation:

1(819⌶)⍵: convert to uppercase
w⊂⍨w=⊃w←' ',: split on spaces
{...}¨: for each word...

s←{⍵⊂⍨1,2≠/⍵}: s is  a function that splits a string into groups of contiguous matching characters
⍵∊'AEIOU': mark the vowels
(...): see which characters to triplicate

~∧∨\: all consonants past the first vowel,
{⌽<\⌽⍵}: the last vowel.
2×: multiply the bit vector by two,
1+: and add one. Now all selected characters have 3 and the rest have 1.

⍵/⍨: replicate each character in ⍵ by the given amount
x←s: split it up into strings of matching characters, and store this in x.
(3⌈≢¨s⍵): the length of each group of matching characters in the input word, with a maximum of 3.
⌊≢¨: the minimum of that and the lengths of the groups in x.
x↑⍨¨: make each group be that length

1↓∊: flatten the result and drop the first character (the space that was added at the beginning to help with splitting)

You beat Adám ... wow.

very neat! If you shuffle it around a bit and write it as a program (using prompt as suggested by Adám) you can shave off another 15 bytes: 1↓∊{c/⍨(≢¨g)⌈3×((⌽<\∘⌽)∨~∧∨\)'AEIOU'∊⍨c←⊃¨g←⍵⊂⍨1,2≠/⍵}¨w⊂⍨w=⊃w←' ',1(819⌶)⍞

JS (ES6), 138 134 129 bytes
s=>s.toUpperCase()[r="replace"](/(\w)\1/g,"$1")[r](/[AEIOU](?=[^AEIOU]*( |$))/g,s=>s+s+s)[r](/\B./g,s=>/[AEIOU]/.test(s)?s:s+s+s)

WAAAYYY TOOO MAAANNNYYY BYYYTTTEEESSS. Contains AEIOU 3 times, but I can't golf those into one.
-4 bytes thanks to HyperNeutrino
Ungolfed
function v(str){
    return str.toUpperCase().replace(/(\w)\1/g,"$1").replace(/[AEIOU](?=[^AEIOU]*( |$))/g,s=>s+s+s).replace(/\B./g,s=>[..."AEIOU"].includes(s)?s:s+s+s);
}

I like to write, not read code.

"WAAAYYY TOOO MAAANNNYYY BYYYTTTEEESSSS" ... is in first place, ahead of APL.

I don't know JS, but can you replace s=>/[AEIOU]/.test(s) with /[AEIOU]/.test?

@musicman523 sadly, no, because it is the conditional in a ternary
operator statement.

FYI, your handling of consonant clusters appears to be slightly incorrect; the proper output would be WAAAYYY TOOO MAAANNNYYY BYTEEESSS (i.e. don't elongate the initial cluster BYT).

Well, was in first place.

Python, 417 bytes
Here's a reference implementation in Python. Not terribly golfed.
import itertools,re
def j(s):return re.match('^[AEIOU]+$',s)
def c(s):return ''.join(sum(([h,h,h]for h in[k for k,g in itertools.groupby(s)]),[]))
def v(s):
 while len(s)>=2 and s[-2]==s[-1]:s=s[:-1]
 return s+s[-1]+s[-1]
def a(n):
 r=''
 for w in n.split():
  if r:r+=' '
  ss=re.split('([AEIOU]+)',w.upper())
  for i,s in enumerate(ss):
   r+=[v(s),s][any(j(t) for t in ss[i+1:])]if j(s)else[s,c(s)][i>0]
 return r

Test with:
while True:
 print a(raw_input('> '))

Shouldn't you at least golf it down further a little by removing unnecessary spaces and changing ss to S?

Python 3, 238 bytes
def f(s):
 s=s.upper();k=[s[0]];s=''.join(k+[s[i]for i in range(1,len(s))if s[i]!=s[i-1]])
 for i in range(1,len(s)):k+=[s[i]]*(3-2*(s[i]in'AEIOU'and i!=max(map(s.rfind,'AEIOU'))))
 return''.join(k)
print(' '.join(map(f,input().split())))

Try it online!

Can you save bytes by setting v to 'AEIOU'?

@Zacharý Thanks, but unfortunately it doesn't change the bytecount.

Oh, the spaces around the first v.

Perl 5, 139 + 1 (-p) = 140 bytes
$_=uc,s/^([^AEIOU]*)//,$s=$1,s/([^AEIOU])\1*/$1x(($q=length$&)>3?$q:3)/ge,s/.*?\K([AEIOU])\1*/$1x(($q=length$&)>3?$q:3)/e,print"$s$_ "for@F

Try it online!
Even handles the "aaaabbbbc" test case in accordance with the example.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Count to 20 with Words!
Using the following length-separated lists of words:
https://github.com/Magic Octopus Urn/wordListsByLength
Print 1 word from each list of length n  from 1 all the way up to 20, here's a valid example:
a
an
and
hand
hands
handle
handles
abandons
abandoned
understand
outstanding
newfoundland
understanding
characteristic
characteristics
characterization
characterizations
characteristically
characterologically
chemotherapeutically

Alternatively (array):
['a', 'an', 'and', 'hand', 'hands', 'handle', 'handles', 'abandons', 'abandoned', 'understand', 'outstanding', 'newfoundland', 'understanding', 'characteristic', 'characteristics', 'characterization', 'characterizations', 'characteristically', 'characterologically', 'chemotherapeutically']

Alternatively (any printable non-alphabetic separator other than \n):
a:an:and:hand:hands:handle:handles:abandons:abandoned:understand:outstanding:newfoundland:understanding:characteristic:characteristics:characterization:characterizations:characteristically:characterologically:chemotherapeutically

Rules

You may choose your own 20 words.
The words must be from the github page provided, more specifically:

1 from 1.txt, 1 from 2.txt, etc...
Note, files above 20.txt exist, but you do not need any words above 20 characters.

Valid separators are ASCII-printable non-alphabetical characters (even numbers, don't care).
Lowercase or uppercase only, pick one, stick with it; no title-case allowed.
Please don't use a 100% copy of my example 20 words...

You can, but that's no fun.
They are likely suboptimal anyways...

If you DON'T want to use the separated files, and need a full list:

Use unsorted.txt, this is all n.txt files in one, sorted alphabetically.

Note, you CANNOT directly read from the URL, it is a common loophole.
This is code-golf, lowest byte-count will be the winner.

For reference, the output is 229 bytes, so anything that gets under that beats hardcoding.

Possible meta-tag-discussion:
user-driven where the user gets to customize their outputs from a list of possibilities?

Following your links got me here, can I use that list?

@LiefdeWen that list is equivalent to this list: unsorted.txt so, yes. If you want to have a full-list of words to parse, use unsorted.txt or that.

As someone from Newfoundland, I appreciate the shoutout. :)

@Christian You could say I... ( •_•)>⌐■-■  understand outstanding newfoundland (⌐■_■)

As long as you understand the pronunciation - which I'm pretty sure you do, based on that.

@StepHen Well, there are compressed strings too, so nah most probably not.

Can we print an array of arrays something like: [["a", "an", "and"],["hand", "hands", "handle", "handles"],...]

@Riley that's stretching it, 1 delimiter inbetween each word, though I can see many situations where that'd help :P.

FYI the three length 1 words do not appear in the unsorted.txt

Are we allowed to use different (although non-alphabetic) delimiters between our words? For example this, would save me two bytes while maintaining Latin-text-read-order. EDIT - looks like your answer to Riley would imply a "no" I think.

@JonathanAllan just did :).

Utility for choosing the words.

@Jim hehe... I wrote something similar.

Jelly,  49 35 31  30 bytes
ṫ3,⁸Ṗ,$€ẎK
“¤ƈȮⱮ⁴⁷ọḤƁŒ|⁾Ė»ḲÇ€K

A niladic link returning a list of characters, or a full program printing that list as a string (the words delimited by spaces).
Try it online!
How?
ṫ3,⁸Ṗ,$€ẎK - Helper link: list of characters, word    e.g. "abreacts"
ṫ3         - tail word from index 3                          "reacts"
   ⁸       - chain's left argument, word
  ,        - pair                               ["reacts","abreacts"]
      $€   - last two links as a monad for €ach of the two words:
    Ṗ      -   pop (all but last character)      "react" / "abreact"
     ,     -   pair       ["react","reacts"] / ["abreact","abreacts"]
        Ẏ  - tighten          ["react","reacts","abreact","abreacts"]
         K - join with spaces         "react reacts abreact abreacts"

“¤ƈȮⱮ⁴⁷ọḤƁŒ|⁾Ė»ḲÇ€K - Link: no arguments
“¤ƈȮⱮ⁴⁷ọḤƁŒ|⁾Ė»     - a compressed string using dictionary indexes:
                    -   "agar abreacts acknowledges codeterminations deindustrializations"
               Ḳ    - split at spaces
                Ç€  - call the last link (Helper) as a monad for €ach
                  K - join with spaces

...which yields:
a ar aga agar react reacts abreact abreacts knowledge knowledges acknowledge acknowledges determination determinations codetermination codeterminations industrialization industrializations deindustrialization deindustrializations

Previous:
@35:
“¡Ụıƭz Xj]"Ɱ*AJƤʂạ5ƬṚṪð^ƥỤ»ḲṖ,$€K€K

Using 10 words and their length-1 prefixes.
@49
“ḊAḥTz¹ỴH¡ṛYẈDƤNŀt#ñ²ĿĊḤlṪnð⁻U+ɦỴĊypṆQ0⁴ṄẉṂi⁻d¤&»

Simply 20 compressed words.

Darn Jelly dictionary! +1

I didn't know Jelly had a dictionary, to be honest.

30 BYTES!??!!??! I just went to sleep and woke up and it's as low as 30 BYTES?!!??!?!11 O_O_O

30 BYTES!?!?!??! I FORGOT ABOUT THIS CHALLENGE FOR A MONTH AND HE WON WITH 30 BYTES!?!?!

Python 2, 145 bytes
print'i am now tiny @ @s##s#ed#act#acts#@#@s#@ed#@ing#arguments#accusation#accusations#advertisings'.replace('#',' counter').replace('@','check')

Try it online!
Prints these words, separated by spaces:
i
am
now
tiny
check
checks
counter
counters
countered
counteract
counteracts
countercheck
counterchecks
counterchecked
counterchecking
counterarguments
counteraccusation
counteraccusations
counteradvertisings

"i am now tiny" - I like the self-descriptive code...

PowerShell, 166 163 bytes
'a
an
and'
'','s','le','ler','lers'|%{"hand$_"}
($a="character")
($x=-split"s ed ful ized istic istics ization izations istically ologically"|%{"$a$_"})
"un"+$x[8]

Try it online!
Hand-optimized, no algorithms. The two loops |%{ } tack on the appropriate ending to the appropriate beginning. I'm searching for a way to get them down into one loop.

Wow, my example looks even dumber now xD! characterful > newfoundland

Python, 169 bytes
z='odahs princesses acclimatizers cyanocobalamines aerothermodynamics underrepresentations'.split()
print([y[:i+1]for x,y in zip(['']+z,z)for i in range(len(x),len(y))])

Prints a list of the words.
Try it online!
Words gained by scanning sequences of matching words, by start or end of the word and starting from length 1 upwards or from length 20 downwords.
Here is the script I used to get it. (the upward-start-matching one)

171 bytes (it feels like it should be shorter, but it isn't): Try it online!

Python 2,  126 120  112 bytes
-8 bytes thanks to Anders Kaseorg (I thought I'd migrated this from Python 3, but turns out I'd forgotten!)
A port of my Jelly answer works well in Python too...
for w in"agar abreacts acknowledges codeterminations deindustrializations".split():print w[2:-1],w[2:],w[:-1],w,

Try it online!
Prints:
a ar aga agar react reacts abreact abreacts knowledge knowledges acknowledge acknowledges determination determinations codetermination codeterminations industrialization industrializations deindustrialization deindustrializations

Python 2 lets you end with print w[2:-1],w[2:],w[:-1],w, for −8 bytes.

Oh, oops I forgot about this or thought I'd done it - I have a TIO page open somewhere with that!

Thanks for that though!

JavaScript, 159 bytes
_='a1an1and}}swwrwrs~~s~ed~ful~ized{{s~|~|s{ally~ologically1misx|s~1x}1hand|ization{~isticxcharacterw}le';for(i of'wx{|}~')with(_.split(i))_=join(pop());f=f=>_

Try it online!
Thanks @HyperNeutrino for edit. But, I am reverting back to old post (removing "Node.js" flag) because it has nothing to do with Node.js. It perfectly works in browsers too.

f=f=>_ threw me off, I was like "won't that override the function" (it would just prevent recursion)

@StepHen. I'm not sure if leaving a plain string is allowed. As I understood, the code should represent a function (or whole program), thats why I added it to the end. Variable _ already contains the string.

You're correct, I was just really confused as to what it did, since you reused the variable name (f as both function name and (ignored) parameter name)

05AB1E, 51 bytes
’¯Óa‚‡’D“€…€¤Þ¨íÊƒé¢Ã¥£žÜ¶ß´ç…àçî×Ü»‡Ûà³ŒçÓs²® ÿ ÿs

Try it online!
Separator:
List of words: a, an, ana, anal, house, houses, amazing, criminal, seriously, apparently, accessories, disciplinary, distributions, discrimination, congratulations, responsibilities, characterizations, telecommunications, representationalist, representationalists

want to participate in own challenge intensifies

I'm guessing 05AB1E has no 20-length words in the dictionary :P? Have yet to actually check myself.

@MagicOctopusUrn Nope.

@adnan wow, that approach... may actually be a good idea if you can find a way to generate all dictionary code-points in like 1-10 bytes...

@adnan Raises eyebrows Try it online!

@MagicOctopusUrn Hmm, that also contains some 'non-dictionary' words, it is possible that this approach could be smaller.

@adnan that was my first attempt, I'm sure you could knock it outta the park.

Ruby, 120 bytes
j=3
$><<?a
"  5  T &  }   <    ".bytes{|i|puts
8.times{|k|$><<%w{dehydro chlori ge n at ion e s}[k]*(j>>7-k&1)}
j+=i-31}

Prints the following. Each word is built from the 8 strings above, using the binary digits of j to select. On each iteration of the loop, j is incremented by the ASCII value of the characters in the string in quotes, minus 31.
a
es
ion
ions
nates
nation
nations
chlorine
chlorines
chlorinate
chlorinates
chlorination
dehydrogenate
dehydrogenates
dehydrogenation
dehydrogenations
dehydrochlorinate
dehydrochlorinates
dehydrochlorination
dehydrochlorinations

Pyth, 74 bytes
Psychopathologically adventuresomenesses
.e:"psychopathologicallyadventuresomenesses"b+bhkiR36"GGGGBKMMKKM6K6M0K0K0

Try it online! It outputs:
['a', 'al', 'all', 'ally', 'logic', 'advent', 'venture', 'ventures', 'adventure', 'adventures', 'venturesome', 'pathological', 'adventuresome', 'pathologically', 'venturesomeness', 'psychopathologic', 'adventuresomeness', 'psychopathological', 'adventuresomenesses', 'psychopathologically']

Which, once formatted yields:
a
al
all
ally
logic
advent
venture
ventures
adventure
adventures
venturesome
pathological
adventuresome
pathologically
venturesomeness
psychopathologic
adventuresomeness
psychopathological
adventuresomenesses
psychopathologically

Explanation
The key was to choose two words that complement each other. I chose "psychopathologically" and "adventuresomenesses" thanks to a little tool I wrote. Using these two words, for any length we can find substrings which are actual words of the provided list. All the possible decompositions are demonstrated by:
a al all ally logic psycho logical          logically pathologic             pathological               pathologically                 psychopathologic                   psychopathological                     psychopathologically
a ad ess ness esses advent venture ventures adventure adventures venturesome              adventuresome                venturesomeness                  adventuresomeness                    adventuresomenesses

The next step is just to get the list of the indexes for a given decomposition. For my decomposition, I chose: 16 16 16 16 11 20 22 22 20 20 22 6 20 6 22 0 20 0 20 0, which are indexes in the concatenated strings: psychopathologicallyadventuresomenesses.
Finally, write a program which just loops over the indexes and display the substring at each given index with increasing length.
For saving bytes, I stored the indexes in a base 36 string. Indeed, GGGGBKMMKKM6K6M0K0K0 is the list of my indexes in base 36 (because my highest index is 22, I could have used base 23).
Program explanation
.e:"psychopathologicallyadventuresomenesses"b+bhkiR36"GGGGBKMMKKM6K6M0K0K0

                                                 iR36"GGGGBKMMKKM6K6M0K0K0    # For each character in the string, convert from base 36 to base 10
.e                                                                            # Loop over indexes: b are the indexes, h their position
  :"psychopathologicallyadventuresomenesses"b+bhk                             # In "psy...ses", select the substring at index b and of length k + 1

psychopathologically - "In terms of the scientific study of mental disorders." Interesting.

Bubblegum, 66 bytes
00000000: 6d8b 410a 0020 0804 bf6a 4407 a134 5aff  m.A.. ...jD..4Z.
00000010: 4fe6 29ac 93ce b0a3 543a ad06 3f6c e769  O.).....T:..?l.i
00000020: 46f3 3ae2 b218 abc4 2cab d389 a805 82aa  F.:.....,.......
00000030: fee1 6e43 2444 62df 0f46 4a1e f356 8cf1  ..nC$Db..FJ..V..
00000040: 73d8                                     s.

Output:
o`al`res`alit`reset`preset`present`rational`represent`rationales`annotations`connotations`connotational`representation`representations`representational`misrepresentation`misrepresentations`representationalism`representationalisms

Try it online!
The words and separator were selected by simulated annealing:
from __future__ import print_function
import math
import random
import zlib

wordlists = \
    [[chr(x).encode() for x in [9, 10] + list(range(32, 127)) if not chr(x).encode().isalpha()]] + \
    [open('wordListsByLength/{}.txt'.format(n), 'rb').read().splitlines() for n in range(1, 21)]

words = [random.choice(wordlist) for wordlist in wordlists]

temperature = 10.
score = 9999
best = score

while True:
    old_score = score
    n = random.randrange(len(wordlists))
    old_word = words[n]
    words[n] = random.choice(wordlists[n])
    z = zlib.compressobj(9, zlib.DEFLATED, -zlib.MAX_WBITS, 9)
    score = len(z.compress(words[0].join(words[1:])) + z.flush())
    if score > old_score and random.random() >= math.exp((old_score - score) / temperature):
        words[n] = old_word
        score = old_score
    else:
        temperature *= .99999
        if score < best:
            best = score
            print(best, repr(words[0].join(words[1:])))

C#, 259 bytes
_=>{var a=new int[7].Select((n,i)=>"abasers".Substring(0,i+1)).ToList();a.Add("abacuses");a.AddRange(new int[12].Select((n,i)=>(i>10?"un":"")+"character"+"|s|ed|ful|ised|istic|istics|isation|isations|istically|ologically|istically|".Split('|')[i]));return a;}

Some obvious room for golfing still but I've run out of time now. I know it's longer than hard coding so will fix it when I get some time later on.

Woops is actually even longer because I need to include using System.Linq;

Just returning them in a string split by spaces is like 245.

@MagicOctopusUrn I know that's what I said in my answer...

05AB1E, 130 68 bytes
-62 bytes thanks to Erik the Outgolfer
743222’€Ü†š ƒ´aî³eros €‡a•¿f²Ñns …¿en®íizers ‚ÀÙŠs ‡åØŽ’#‚øε`ηRs£R}˜

Try it online!
Takes as many prefixes as needed from each of the following words:
amusers
carabinero
foraminiferans
photosensitizers
videoconferencings
radiopharmaceuticals

Prints these words in an array:
a
am
amu
amus
amuse
amuser
amusers
carabine
carabiner
carabinero
carabineros
foraminifera
foraminiferan
foraminiferans
photosensitizer
photosensitizers
videoconferencing
videoconferencings
radiopharmaceutical
radiopharmaceuticals

You can significantly golf this (-43).

And another -13.

Some other -6 too... (sadly I can't replace 743222 with •B/™•)

Yeah, you don't need the S so it's -62 bytes. ;)

@EriktheOutgolfer Thanks! I was trying to do something like that last one, but I couldn't make it work. Do you mind explaining how the compressed strings works?

’ means "no-implicit-space compressed string". Then there's the compressor which would compress the words.

Note that only 100 different chars are used to compress words, the others (like s) are put verbatim into the string. Every word is 2 chars, and there are 10000 words. Each char is assigned an index from 00 to 99. Two such chars make a 4-digit number (leading zero matters) from 0000 to 9999. That's the index of the particular word. The chars are in order: €‚ƒ„…†‡ˆ‰Š‹ŒŽ•–—™š›œžŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîï. Quote types include “ (normal), ” (titlecase), ‘ (uppercase) and ’ (no implicit space).

Bubblegum, 78 bytes
00000000: 654b c301 4431 10bd a7cb d876 9a5f efe7  eK..D1.....v._..
00000010: 781e 2080 ee55 0488 ffc8 9f69 e86f a5ff  x. ..U.....i.o..
00000020: ce00 0b98 202e 34ed d701 a464 bf59 35fb  .... .4....d.Y5.
00000030: 23d7 9192 b948 7c79 f351 0c8b f4ee 06e4  #....H|y.Q......
00000040: 8b05 1a33 77c8 1bcf 7f58 7577 e113       ...3w....Xuw..

Try it online!

Ruby, 107 bytes
p(z=%w{o or for form ultra})+[z[3],c="centrifug",z[4]+c].product(%w{ed ing ally ation ations}).map{|i|i*""}

Prints the following array.
["o", "or", "for", "form", "ultra", "formed", "forming", "formally", "formation", "formations", "centrifuged", "centrifuging", "centrifugally", "centrifugation", "centrifugations", "ultracentrifuged", "ultracentrifuging", "ultracentrifugally", "ultracentrifugation", "ultracentrifugations"

Changing the p for puts (with trailing space) gives the following at a cost of an additional 4 bytes.
o
or
for
form
ultra
formed
forming
formally
formation
formations
centrifuged
centrifuging
centrifugally
centrifugation
centrifugations
ultracentrifuged
ultracentrifuging
ultracentrifugally
ultracentrifugation
ultracentrifugations

Japt, 119 bytes
`av„v„dvjvjsvj¤vj¤svfœejvqvqsvq‚vqˆgvqizƒvqÄKcvqÄKcsvqizÂ\nvqizÂ\nsvq‰tkvqologkv·sqizÂ\ns`d'j`Ê@`'k`Åœ§`'q`Ö‹a×` q'v ·

Try it online!
Prints:
a
an
and
hand
hands
handle
handles
freehand
character
characters
charactered
charactering
characterizes
characteristic
characteristics
characterization
characterizations
characteristically
characterologically
mischaracterizations