Table list doesn't load after saving a question

#1

After saving a question, I’m unable to ask a new question as my list of tables won’t load.

This is the stack trace I’m seeing in the console:

{:message nil,
 :type java.lang.NullPointerException,
 :stacktrace
 ("clojure.core$name.invokeStatic(core.clj:1595)"
  "clojure.core$name.invoke(core.clj:1589)"
  "clojure.core$comp$fn__5792.invoke(core.clj:2569)"
  "clojure.core$map$fn__5851.invoke(core.clj:2755)"
  "clojure.lang.LazySeq.sval(LazySeq.java:42)"
  "clojure.lang.LazySeq.seq(LazySeq.java:51)"
  "clojure.lang.RT.seq(RT.java:531)"
  "clojure.core$seq__5387.invokeStatic(core.clj:137)"
  "clojure.core$some.invokeStatic(core.clj:2692)"
  "clojure.core$some.invoke(core.clj:2692)"
  "--> api.database$card_has_ambiguous_columns_QMARK_.invokeStatic(database.clj:96)"
  "api.database$card_has_ambiguous_columns_QMARK_.invoke(database.clj:80)"
  "api.database$source_query_cards.invokeStatic(database.clj:116)"
  "api.database$source_query_cards.invoke(database.clj:106)"
  "api.database$cards_virtual_tables.invokeStatic(database.clj:123)"
  "api.database$cards_virtual_tables.doInvoke(database.clj:118)"
  "api.database$saved_cards_virtual_db_metadata.invokeStatic(database.clj:128)"
  "api.database$saved_cards_virtual_db_metadata.doInvoke(database.clj:126)"
  "api.database$add_virtual_tables_for_saved_cards.invokeStatic(database.clj:137)"
  "api.database$add_virtual_tables_for_saved_cards.invoke(database.clj:136)"
  "api.database$dbs_list.invokeStatic(database.clj:144)"
  "api.database$dbs_list.invoke(database.clj:142)"
  "api.database$fn__56520.invokeStatic(database.clj:155)"
  "api.database$fn__56520.invoke(database.clj:148)"
  "middleware.auth$enforce_authentication$fn__42607.invoke(auth.clj:14)"
  "routes$fn__60631$fn__60632.doInvoke(routes.clj:113)"
  "middleware.exceptions$catch_uncaught_exceptions$fn__42520.invoke(exceptions.clj:104)"
  "middleware.exceptions$catch_api_exceptions$fn__42517.invoke(exceptions.clj:92)"
  "middleware.log$log_api_call$fn__42438$fn__42439.invoke(log.clj:68)"
  "middleware.log$log_api_call$fn__42438.invoke(log.clj:64)"
  "middleware.security$add_security_headers$fn__42481.invoke(security.clj:102)"
  "middleware.json$wrap_json_body$fn__42690.invoke(json.clj:61)"
  "middleware.json$wrap_streamed_json_response$fn__42708.invoke(json.clj:120)"
  "middleware.session$bind_current_user$fn__42812$fn__42813.invoke(session.clj:159)"
  "middleware.session$do_with_current_user.invokeStatic(session.clj:142)"
  "middleware.session$do_with_current_user.invoke(session.clj:136)"
  "middleware.session$bind_current_user$fn__42812.invoke(session.clj:158)"
  "middleware.session$wrap_current_user_id$fn__42801.invoke(session.clj:127)"
  "middleware.session$wrap_session_id$fn__42786.invoke(session.clj:89)"
  "middleware.auth$wrap_api_key$fn__42615.invoke(auth.clj:27)"
  "middleware.misc$maybe_set_site_url$fn__42581.invoke(misc.clj:54)"
  "middleware.misc$bind_user_locale$fn__42584.invoke(misc.clj:70)"
  "middleware.misc$add_content_type$fn__42571.invoke(misc.clj:29)"
  "middleware.misc$wrap_gzip$fn__42599.invoke(misc.clj:97)")}

If I go in and manually mark it as archived in the report_card table (MySQL), my list will again load. However, saving a new question produces the same results.

I’ve tried running versions 0.32.0 through 0.32.4 of the .jar with no difference in outcome.

Has anyone else encountered this?

#2

Hi @harrywynn
Are there any errors/warnings before the actual stacktrace?
So you’re using MySQL as your backend for metadata? Which version of MySQL?
Do you see any errors in MySQL?
Are you using a reverse proxy like Nginx?

#3

Hey @flamber

No, there aren’t any other errors or warnings before this happens. Everything seems to be working fine up until that point. I’m just running the .jar from the terminal on macOS right now. MySQL version is 5.7.16

If I run a new question and save it then everything works fine. If I archive the question, again everything is fine. If I flip the question back to not be archived, then it breaks again.

#4

I’m not sure if there’s something else that needs to be flipped, but editing the internal database is not recommended - you should be using the API:
https://github.com/metabase/metabase/wiki/Using-the-REST-API
https://github.com/metabase/metabase/blob/master/docs/api-documentation.md

#5

I was just editing it manually to try and get to the bottom of why the saved card is causing my list of databases to not load. It’s not something I would do as a permanent solution.

#6

I’m not sure how to debug - haven’t seen that error before.
Did you upgrade to 0.32.4 or are you just starting out with Metabase?
Do you see any errors in MySQL?
Are you trying to make a query on a table, which is empty?
Can you reproduce this error, when using the Sample Dataset? If yes, please give steps.

#7

@flamber thanks for your help here. I was experiencing errors with the saves to report_card and the data being too long for the result_metadata column, so I change the type. Apparently this also caused the other problem I originally posted about here as changing it back to text resolved it for me.

#8

@harrywynn
Yeah, you need to define larger type for some columns, since TEXT/BLOB is “only” 64KB, whereas MEDIUM.... can be 16MB and LONG.... can be 4GB.
https://stackoverflow.com/questions/6766781/maximum-length-for-mysql-type-text
Specially a problem in the table query_cache if you have large results.

#9

I suppose this is still a bug though, as changing the column type to medium or long blob causes the break.

#10

But what errors do you get? Check Metabase log and MySQL log.

If you’re changing a column type from TEXT to MEDIUMBLOB, then it will probably fail, since it’s two different types, but you should be able to change it to MEDIUMTEXT

I’m using MariaDB 10.3 and I think I only changed the COLLATION to utf8mb4_unicode_ci and then column query_cache.results from BLOB to LONGBLOB

#11

Derp, changing it to blob was definitely my problem. Thanks for pointing it out!