#1 by m_hr3
Hi, I get the following error when I try to start a session with Heroku. Everything worked fine yesterday and I didn't change anything... Any tips on what might be the issue? Thanks a lot! Failed to create session: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type integer: "" LINE 1: ..., '0', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, ... ^ [SQL: INSERT INTO "network_1_app_multiplayer_V2_player" (id_in_group, _payoff, round_number, _role, type, demrole, ties_purchased, tie_purchase_1, tie_purchase_2, tie_purchase_3, total_ties, suivant, "N1best", rightchoice, bandit_choice_1, bandit_choice_2, points_1, points_2, demprivatesignal, "SL_payoff", "N1tie_choices_treatment", tie_choice_any, "N1tie_budget_used_after_round", "N1_choice_condition_1", "N1_choice_condition_2", "N1_choice_condition_3", "N1_choice_condition_4", "N1_choice_condition_5", "SL_bandit_choice_no_social_info", "N1round_1_payoffIL", "N1round_2_payoffIL", "N1round_3_payoffIL", "N1round_4_payoffIL", "N1round_5_payoffIL", "SL_payoff_round_1", "SL_payoff_round_2", "SL_payoff_round_3", "SL_payoff_round_4", "SL_payoff_round_5", "SLpayoffN1", paid_round, "IL_final_payoffN1", round, "payoffN1", tie_condition, nums_selected, draw_1, draw_2, "N1_D1_B_MSB", "N1_D1_R_MSR", "N1_D2_B_MSB", "N1_D2_R_MSR", "N1_D3_B_MSB", "N1_D3_R_MSR", "N1_D2D3_BB_MSB", "N1_D2D3_RR_MSR", "N1_D2D3_RB_MSB", "N1_D2D3_RB_MSR", "N1_D2D1_BB_MSB", "N1_D2D1_RR_MSR", "N1_D2D1_RB_MSB", "N1_D2D1_RB_MSR", "N1_D1D3_BB_MSB", "N1_D1D3_RR_MSR", "N1_D1D3_RB_MSB", "N1_D1D3_RB_MSR", "N1_D1D2D3_BBB_MSB", "N1_D1D2D3_BBR_MSB", "N1_D1D2D3_BBR_MSR", "N1_D1D2D3_BRR_MSR", "N1_D1D2D3_BRR_MSB", "N1_D1D2D3_RRR_MSR", subsession_id, group_id, participant_id, session_id) VALUES (%(id_in_group)s, %(_payoff)s, %(round_number)s, %(_role)s, %(type)s, %(demrole)s, %(ties_purchased)s, %(tie_purchase_1)s, %(tie_purchase_2)s, %(tie_purchase_3)s, %(total_ties)s, %(suivant)s, %(N1best)s, %(rightchoice)s, %(bandit_choice_1)s, %(bandit_choice_2)s, %(points_1)s, %(points_2)s, %(demprivatesignal)s, %(SL_payoff)s, %(N1tie_choices_treatment)s, %(tie_choice_any)s, %(N1tie_budget_used_after_round)s, %(N1_choice_condition_1)s, %(N1_choice_condition_2)s, %(N1_choice_condition_3)s, %(N1_choice_condition_4)s, %(N1_choice_condition_5)s, %(SL_bandit_choice_no_social_info)s, %(N1round_1_payoffIL)s, %(N1round_2_payoffIL)s, %(N1round_3_payoffIL)s, %(N1round_4_payoffIL)s, %(N1round_5_payoffIL)s, %(SL_payoff_round_1)s, %(SL_payoff_round_2)s, %(SL_payoff_round_3)s, %(SL_payoff_round_4)s, %(SL_payoff_round_5)s, %(SLpayoffN1)s, %(paid_round)s, %(IL_final_payoffN1)s, %(round)s, %(payoffN1)s, %(tie_condition)s, %(nums_selected)s, %(draw_1)s, %(draw_2)s, %(N1_D1_B_MSB)s, %(N1_D1_R_MSR)s, %(N1_D2_B_MSB)s, %(N1_D2_R_MSR)s, %(N1_D3_B_MSB)s, %(N1_D3_R_MSR)s, %(N1_D2D3_BB_MSB)s, %(N1_D2D3_RR_MSR)s, %(N1_D2D3_RB_MSB)s, %(N1_D2D3_RB_MSR)s, %(N1_D2D1_BB_MSB)s, %(N1_D2D1_RR_MSR)s, %(N1_D2D1_RB_MSB)s, %(N1_D2D1_RB_MSR)s, %(N1_D1D3_BB_MSB)s, %(N1_D1D3_RR_MSR)s, %(N1_D1D3_RB_MSB)s, %(N1_D1D3_RB_MSR)s, %(N1_D1D2D3_BBB_MSB)s, %(N1_D1D2D3_BBR_MSB)s, %(N1_D1D2D3_BBR_MSR)s, %(N1_D1D2D3_BRR_MSR)s, %(N1_D1D2D3_BRR_MSB)s, %(N1_D1D2D3_RRR_MSR)s, %(subsession_id)s, %(group_id)s, %(participant_id)s, %(session_id)s) RETURNING "network_1_app_multiplayer_V2_player".id] [parameters: {'id_in_group': 1, '_payoff': '0', 'round_number': 1, '_role': '', 'type': None, 'demrole': None, 'ties_purchased': None, 'tie_purchase_1': None, 'tie_purchase_2': None, 'tie_purchase_3': None, 'total_ties': '', 'suivant': None, 'N1best': None, 'rightchoice': None, 'bandit_choice_1': None, 'bandit_choice_2': None, 'points_1': None, 'points_2': None, 'demprivatesignal': None, 'SL_payoff': None, 'N1tie_choices_treatment': None, 'tie_choice_any': False, 'N1tie_budget_used_after_round': None, 'N1_choice_condition_1': None, 'N1_choice_condition_2': None, 'N1_choice_condition_3': None, 'N1_choice_condition_4': None, 'N1_choice_condition_5': None, 'SL_bandit_choice_no_social_info': None, 'N1round_1_payoffIL': None, 'N1round_2_payoffIL': None, 'N1round_3_payoffIL': None, 'N1round_4_payoffIL': None, 'N1round_5_payoffIL': None, 'SL_payoff_round_1': None, 'SL_payoff_round_2': None, 'SL_payoff_round_3': None, 'SL_payoff_round_4': None, 'SL_payoff_round_5': None, 'SLpayoffN1': None, 'paid_round': None, 'IL_final_payoffN1': None, 'round': None, 'payoffN1': None, 'tie_condition': None, 'nums_selected': None, 'draw_1': None, 'draw_2': None, 'N1_D1_B_MSB': None, 'N1_D1_R_MSR': None, 'N1_D2_B_MSB': None, 'N1_D2_R_MSR': None, 'N1_D3_B_MSB': None, 'N1_D3_R_MSR': None, 'N1_D2D3_BB_MSB': None, 'N1_D2D3_RR_MSR': None, 'N1_D2D3_RB_MSB': None, 'N1_D2D3_RB_MSR': None, 'N1_D2D1_BB_MSB': None, 'N1_D2D1_RR_MSR': None, 'N1_D2D1_RB_MSB': None, 'N1_D2D1_RB_MSR': None, 'N1_D1D3_BB_MSB': None, 'N1_D1D3_RR_MSR': None, 'N1_D1D3_RB_MSB': None, 'N1_D1D3_RB_MSR': None, 'N1_D1D2D3_BBB_MSB': None, 'N1_D1D2D3_BBR_MSB': None, 'N1_D1D2D3_BBR_MSR': None, 'N1_D1D2D3_BRR_MSR': None, 'N1_D1D2D3_BRR_MSB': None, 'N1_D1D2D3_RRR_MSR': None, 'subsession_id': 26, 'group_id': 26, 'participant_id': 21, 'session_id': 6}] (Background on this error at: http://sqlalche.me/e/13/9h9h) Traceback (most recent call last): File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context self.dialect.do_execute( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 609, in do_execute cursor.execute(statement, parameters) psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: "" LINE 1: ..., '0', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, ... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/.heroku/python/lib/python3.9/site-packages/otree/session.py", line 447, in create_session_traceback_wrapper return create_session(**kwargs) File "/app/.heroku/python/lib/python3.9/site-packages/otree/session.py", line 347, in create_session db.commit() File "/app/.heroku/python/lib/python3.9/site-packages/otree/database.py", line 187, in commit return self._db.commit() File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1046, in commit self.transaction.commit() File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 504, in commit self._prepare_impl() File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 483, in _prepare_impl self.session.flush() File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2540, in flush self._flush(objects) File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2682, in _flush transaction.rollback(_capture_exception=True) File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 68, in __exit__ compat.raise_( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_ raise exception File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 2642, in _flush flush_context.execute() File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute rec.execute(self) File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 586, in execute persistence.save_obj( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 239, in save_obj _emit_insert_statements( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 1135, in _emit_insert_statements result = cached_connections[connection].execute( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1011, in execute return meth(self, multiparams, params) File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement ret = self._execute_context( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context self._handle_dbapi_exception( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception util.raise_( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 182, in raise_ raise exception File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context self.dialect.do_execute( File "/app/.heroku/python/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 609, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.DataError: (psycopg2.errors.InvalidTextRepresentation) invalid input syntax for type integer: "" LINE 1: ..., '0', 1, '', NULL, NULL, NULL, NULL, NULL, NULL, '', NULL, ... ^ [SQL: INSERT INTO "network_1_app_multiplayer_V2_player" (id_in_group, _payoff, round_number, _role, type, demrole, ties_purchased, tie_purchase_1, tie_purchase_2, tie_purchase_3, total_ties, suivant, "N1best", rightchoice, bandit_choice_1, bandit_choice_2, points_1, points_2, demprivatesignal, "SL_payoff", "N1tie_choices_treatment", tie_choice_any, "N1tie_budget_used_after_round", "N1_choice_condition_1", "N1_choice_condition_2", "N1_choice_condition_3", "N1_choice_condition_4", "N1_choice_condition_5", "SL_bandit_choice_no_social_info", "N1round_1_payoffIL", "N1round_2_payoffIL", "N1round_3_payoffIL", "N1round_4_payoffIL", "N1round_5_payoffIL", "SL_payoff_round_1", "SL_payoff_round_2", "SL_payoff_round_3", "SL_payoff_round_4", "SL_payoff_round_5", "SLpayoffN1", paid_round, "IL_final_payoffN1", round, "payoffN1", tie_condition, nums_selected, draw_1, draw_2, "N1_D1_B_MSB", "N1_D1_R_MSR", "N1_D2_B_MSB", "N1_D2_R_MSR", "N1_D3_B_MSB", "N1_D3_R_MSR", "N1_D2D3_BB_MSB", "N1_D2D3_RR_MSR", "N1_D2D3_RB_MSB", "N1_D2D3_RB_MSR", "N1_D2D1_BB_MSB", "N1_D2D1_RR_MSR", "N1_D2D1_RB_MSB", "N1_D2D1_RB_MSR", "N1_D1D3_BB_MSB", "N1_D1D3_RR_MSR", "N1_D1D3_RB_MSB", "N1_D1D3_RB_MSR", "N1_D1D2D3_BBB_MSB", "N1_D1D2D3_BBR_MSB", "N1_D1D2D3_BBR_MSR", "N1_D1D2D3_BRR_MSR", "N1_D1D2D3_BRR_MSB", "N1_D1D2D3_RRR_MSR", subsession_id, group_id, participant_id, session_id) VALUES (%(id_in_group)s, %(_payoff)s, %(round_number)s, %(_role)s, %(type)s, %(demrole)s, %(ties_purchased)s, %(tie_purchase_1)s, %(tie_purchase_2)s, %(tie_purchase_3)s, %(total_ties)s, %(suivant)s, %(N1best)s, %(rightchoice)s, %(bandit_choice_1)s, %(bandit_choice_2)s, %(points_1)s, %(points_2)s, %(demprivatesignal)s, %(SL_payoff)s, %(N1tie_choices_treatment)s, %(tie_choice_any)s, %(N1tie_budget_used_after_round)s, %(N1_choice_condition_1)s, %(N1_choice_condition_2)s, %(N1_choice_condition_3)s, %(N1_choice_condition_4)s, %(N1_choice_condition_5)s, %(SL_bandit_choice_no_social_info)s, %(N1round_1_payoffIL)s, %(N1round_2_payoffIL)s, %(N1round_3_payoffIL)s, %(N1round_4_payoffIL)s, %(N1round_5_payoffIL)s, %(SL_payoff_round_1)s, %(SL_payoff_round_2)s, %(SL_payoff_round_3)s, %(SL_payoff_round_4)s, %(SL_payoff_round_5)s, %(SLpayoffN1)s, %(paid_round)s, %(IL_final_payoffN1)s, %(round)s, %(payoffN1)s, %(tie_condition)s, %(nums_selected)s, %(draw_1)s, %(draw_2)s, %(N1_D1_B_MSB)s, %(N1_D1_R_MSR)s, %(N1_D2_B_MSB)s, %(N1_D2_R_MSR)s, %(N1_D3_B_MSB)s, %(N1_D3_R_MSR)s, %(N1_D2D3_BB_MSB)s, %(N1_D2D3_RR_MSR)s, %(N1_D2D3_RB_MSB)s, %(N1_D2D3_RB_MSR)s, %(N1_D2D1_BB_MSB)s, %(N1_D2D1_RR_MSR)s, %(N1_D2D1_RB_MSB)s, %(N1_D2D1_RB_MSR)s, %(N1_D1D3_BB_MSB)s, %(N1_D1D3_RR_MSR)s, %(N1_D1D3_RB_MSB)s, %(N1_D1D3_RB_MSR)s, %(N1_D1D2D3_BBB_MSB)s, %(N1_D1D2D3_BBR_MSB)s, %(N1_D1D2D3_BBR_MSR)s, %(N1_D1D2D3_BRR_MSR)s, %(N1_D1D2D3_BRR_MSB)s, %(N1_D1D2D3_RRR_MSR)s, %(subsession_id)s, %(group_id)s, %(participant_id)s, %(session_id)s) RETURNING "network_1_app_multiplayer_V2_player".id] [parameters: {'id_in_group': 1, '_payoff': '0', 'round_number': 1, '_role': '', 'type': None, 'demrole': None, 'ties_purchased': None, 'tie_purchase_1': None, 'tie_purchase_2': None, 'tie_purchase_3': None, 'total_ties': '', 'suivant': None, 'N1best': None, 'rightchoice': None, 'bandit_choice_1': None, 'bandit_choice_2': None, 'points_1': None, 'points_2': None, 'demprivatesignal': None, 'SL_payoff': None, 'N1tie_choices_treatment': None, 'tie_choice_any': False, 'N1tie_budget_used_after_round': None, 'N1_choice_condition_1': None, 'N1_choice_condition_2': None, 'N1_choice_condition_3': None, 'N1_choice_condition_4': None, 'N1_choice_condition_5': None, 'SL_bandit_choice_no_social_info': None, 'N1round_1_payoffIL': None, 'N1round_2_payoffIL': None, 'N1round_3_payoffIL': None, 'N1round_4_payoffIL': None, 'N1round_5_payoffIL': None, 'SL_payoff_round_1': None, 'SL_payoff_round_2': None, 'SL_payoff_round_3': None, 'SL_payoff_round_4': None, 'SL_payoff_round_5': None, 'SLpayoffN1': None, 'paid_round': None, 'IL_final_payoffN1': None, 'round': None, 'payoffN1': None, 'tie_condition': None, 'nums_selected': None, 'draw_1': None, 'draw_2': None, 'N1_D1_B_MSB': None, 'N1_D1_R_MSR': None, 'N1_D2_B_MSB': None, 'N1_D2_R_MSR': None, 'N1_D3_B_MSB': None, 'N1_D3_R_MSR': None, 'N1_D2D3_BB_MSB': None, 'N1_D2D3_RR_MSR': None, 'N1_D2D3_RB_MSB': None, 'N1_D2D3_RB_MSR': None, 'N1_D2D1_BB_MSB': None, 'N1_D2D1_RR_MSR': None, 'N1_D2D1_RB_MSB': None, 'N1_D2D1_RB_MSR': None, 'N1_D1D3_BB_MSB': None, 'N1_D1D3_RR_MSR': None, 'N1_D1D3_RB_MSB': None, 'N1_D1D3_RB_MSR': None, 'N1_D1D2D3_BBB_MSB': None, 'N1_D1D2D3_BBR_MSB': None, 'N1_D1D2D3_BBR_MSR': None, 'N1_D1D2D3_BRR_MSR': None, 'N1_D1D2D3_BRR_MSB': None, 'N1_D1D2D3_RRR_MSR': None, 'subsession_id': 26, 'group_id': 26, 'participant_id': 21, 'session_id': 6}] (Background on this error at: http://sqlalche.me/e/13/9h9h)
#2 by Chris_oTree
It looks like somewhere you are setting an IntegerField to the empty string, I.e. "". For example: player.xyz = "" That is not a valid value for an IntegerField.
#3 by m_hr3 (edited )
Thanks a lot! I did find the issue in the end. It was indeed an IntegerField. Thanks so much!!