Angular.js: Extremely long error URLs that sometimes don't lead to anything

Created on 31 Jan 2014  路  14Comments  路  Source: angular/angular.js

Sometimes I get really long error URLs in my Karma tests, like the one pasted below.

Try clicking on it, the only thing you'll get is:

Failed to instantiate module {0} due to:
{1}

that doesn't say a lot.

http://errors.angularjs.org/1.2.10/$injector/modulerr?p0=test%2Fmocks-inlined%2Flanguage-tags.json&p1=%5B%24injector%3Anomod%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.2.10%2F%24injector%2Fnomod%3Fp0%3Dtest%252Fmocks-inlined%252Flanguage-tags.json%0Ax%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A92%0AVc%2Fb.module%3C%2F%3C%2Fb%5Be%5D%3C%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A106%0AVc%2Fb.module%3C%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A106%0Ae%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A115%0Aq%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A93%0Ae%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A115%0A%24b%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A118%0AworkFn%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Ftest%2Funit%2Fvendor%2Fangular-mocks.js%3F1391195050000%3A2144%0Ajasmine.Block.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A1145%0Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%0Ajasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2130%0Ajasmine.Spec.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2458%0Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%0Ajasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2130%0Ajasmine.Suite.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2604%0Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%0Ajasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2130%0Ajasmine.Suite.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2604%0Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%0Ajasmine.Queue.prototype.next_%2FonComplete%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2173%0Ajasmine.Suite.prototype.finish%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2561%0Ajasmine.Suite.prototype.execute%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2605%0Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2187%0Ajasmine.Queue.prototype.next_%2FonComplete%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2173%0Ajasmine.Spec.prototype.finish%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2432%0Ajasmine.Spec.prototype.execute%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2459%0Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2187%0Ajasmine.Queue.prototype.next_%2FonComplete%2F%3C%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2167%0A

misc core moderate duplicate bug docs

Most helpful comment

Whilst this may not (or may be) still an issue in Chrome, it certainly is when running automated tests -- so much so that I imagine I am missing some flag that might produce errors that are not a hundred lines of URL-encoded URLs....

All 14 comments

The issue with this is that we're including the stack trace in the minErr message

throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
                  module, e.stack || e.message || e);

This would be a really easy fix, but I wonder if there might be a more appropriate fix for this issue. It would be good to include the stack trace in the generated link, but not show it in the link itself... I don't really know how that would work.

This could be improved though, for sure

One problem is this stack trace is not available to see under the generated URL...

@mzgol do you have code that caused this issue?

I agree that this is poor UX, but we also want to be able to reconstruct the error at errors.angularjs.org including stacktrace if the error message contained a stacktrace (usually because an error has been rethrown as a new error)

I don't have the code now but AFAIK it was a misspelled module name loaded in Karma by module("name").

While long URLs are itself a problem (imagine seeing all that in the console, especially if the error is repeated a lot) but the bigger problem is that there is absolutely no information under the link... It seems the URL is not parsed in a meaningful way here.

the docs app that is parses the url to display more info about the error is throwing an exception. that's why there is no additional info about the issue.

error from console:

Error: [$sanitize:badparse] http://errors.angularjs.org/1.2.12/$sanitize/badparse?p0=%3C%40%3Ca%20target%3Dblank%22%20href%3D%22http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A92%22%3Ehttp%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F139119...%3C%2Fa%3E%0AVc%2Fb.module%3C%2F%3C%2Fb%5Be%5D%3C%40%3Ca%20target%3D%_blank%22%20href%3D%22http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A106%22%3Ehttp%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F139119...%3C%2Fa%3E%0AVc%2Fb.module%3C%2F%3C%40%3Ca%20target%3D%_blank%22%20href%3D%22http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A106%22%3Ehttp%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F139119...%3C%2Fa%3E%0Ae%2F%3C%40%3Ca%20target%3D%_blank%22%20href%3D%22http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A115%22%3Ehttp%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F139119...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Aq%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A93%22%3Eq%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ae%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A115%22%3Ee%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391...%3C%2Fa%3E%0A%24%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ab%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391195095000%3A118%22%3Eb%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fdist%2Fbc6337f5.vendor.js%3F1391...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3AworkFn%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Ftest%2Funit%2Fvendor%2Fangular-mocks.js%3F1391195050000%3A2144%22%3EworkFn%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Ftest%2Funit%2Fvendor%2Fangula...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Block.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A1145%22%3Ejasmine.Block.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbas...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%22%3Ejasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2130%22%3Ejasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Spec.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2458%22%3Ejasmine.Spec.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%22%3Ejasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2130%22%3Ejasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Suite.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2604%22%3Ejasmine.Suite.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbas...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%22%3Ejasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2130%22%3Ejasmine.Queue.prototype.start%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Suite.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2604%22%3Ejasmine.Suite.prototype.execute%40http%3A%2F%2Flocalhost%3A8080%2Fbas...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2177%22%3Ejasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0Ajasmine.Queue.prototype.next_%2F%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3AonComplete%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2173%22%3EonComplete%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Suite.prototype.finish%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2561%22%3Ejasmine.Suite.prototype.finish%40http%3A%2F%2Flocalhost%3A8080%2Fbase...%3C%2Fa%3E%0Ajasmine.Suite.prototype.execute%2F%3C%40%3Ca%20target%3D%_blank%22%20href%3D%22http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2605%22%3Ehttp%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2187%22%3Ejasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0Ajasmine.Queue.prototype.next_%2F%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3AonComplete%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2173%22%3EonComplete%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Spec.prototype.finish%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2432%22%3Ejasmine.Spec.prototype.finish%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0Ajasmine.Spec.prototype.execute%2F%3C%40%3Ca%20target%3D%_blank%22%20href%3D%22http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2459%22%3Ehttp%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib...%3C%2Fa%3E%0A%3Ca%20target%3D%_blank%22%20href%3D%22mailto%3Ajasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2187%22%3Ejasmine.Queue.prototype.next_%40http%3A%2F%2Flocalhost%3A8080%2Fbase%2F...%3C%2Fa%3E%0Ajasmine.Queue.prototype.next_%2FonComplete%2F%3C%40%3Ca%20target%3D%_blank%22%20href%3D%22http%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib%2Fjasmine.js%3F1374365571000%3A2167%22%3Ehttp%3A%2F%2Flocalhost%3A8080%2Fbase%2Fnode_modules%2Fkarma-jasmine%2Flib...%3C%2Fa%3E%0A
    at Error (native)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js:6:450
    at F (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular-sanitize.min.js:8:302)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular-sanitize.min.js:12:185
    at http://docs.angularjs.org/js/docs.js:343:12
    at link (http://docs.angularjs.org/js/docs.js:382:20)
    at H (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js:49:375)
    at f (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js:42:399)
    at f (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js:42:416)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js:42:67 

I've just got a 374 thousand (yup, 1/3 of a million) bytes long URL. :-) Such things are able to crash the browser.

It'd be good to pinpoint the issue but, in the meantime a hard limit on the length of the URL might help; this long URLs are not helpful anyway.

This was Angular 1.3.14, I'll check with 1.4 later.

How do I stop the noise in my testing console? It's extremely irritating.

I agree, is there a way to switch to normal error reporting?
In the Chrome developer tools, this results in entirely useless error messages since the console cuts off long lines:
image

Is this still affecting chrome 45/46? I recall some cls landing which read like they would have addressed this issue, so i just assumed this had been resolved. Can you still reproduce this with Canary?

Version 46.0.2471.0 canary (64-bit)
image

Whilst this may not (or may be) still an issue in Chrome, it certainly is when running automated tests -- so much so that I imagine I am missing some flag that might produce errors that are not a hundred lines of URL-encoded URLs....

any recommended solutions for while in test?

IMO there should be an option to truncate urls in stack traces

Duplicate of #14744 and the the url length will be configurable (and capped by default) in the future: #15707

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jtorbicki picture jtorbicki  路  3Comments

visnup picture visnup  路  3Comments

tdumitrescu picture tdumitrescu  路  3Comments

nosideeffects picture nosideeffects  路  3Comments

brijesh1ec picture brijesh1ec  路  3Comments