nil.unpack error

Support Ticket

+status
closed
 

My WAGN installation has been generating the following stacktrace when you navigate to the base URI:

 

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 10.0px Helvetica; min-height: 12.0px} span.Apple-tab-span {white-space:pre}

NoMethodError in Card#show

 

Showing app/views/views/_open.rhtml where line #5 raised:

 

You have a nil object when you didn't expect it!

The error occurred while evaluating nil.unpack

Extracted source (around line #5):

 

2: <%= slot.header %>  

3: <% end %>

4: 

5: <%= slot.wrap_content( slot.render(:expanded_view_content) ) %>

6: 

7: <%= slot.notice %>

8: <% if card.ok?(:comment) %> <%#and !card.hard_template %>

Trace of template inclusion: app/views/layouts/application.html.erb

 

RAILS_ROOT: /var/www/wagn

 

Application Trace | Framework Trace | Full Trace

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:265:in `read_state'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:224:in `next_sequence'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:255:in `open_lock'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:252:in `open'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:223:in `next_sequence'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:160:in `initialize'

/var/www/wagn/app/helpers/slot.rb:137:in `new'

/var/www/wagn/app/helpers/slot.rb:137:in `wrap'

/var/www/wagn/app/helpers/slot.rb:328:in `render'

/var/www/wagn/app/helpers/slot.rb:571:in `process_inclusion'

/var/www/wagn/app/helpers/slot.rb:468:in `expand_inclusion'

/var/www/wagn/app/helpers/slot.rb:430:in `expand_inclusions'

/var/www/wagn/app/helpers/slot.rb:429:in `gsub'

/var/www/wagn/app/helpers/slot.rb:429:in `expand_inclusions'

/var/www/wagn/app/helpers/slot.rb:343:in `render_expanded_view_content'

/var/www/wagn/app/helpers/slot.rb:281:in `render'

/var/www/wagn/app/views/views/_open.rhtml:5:in `_run_rhtml_app47views47views47_open46rhtml_locals_card_object_open_slot'

/var/www/wagn/app/helpers/slot.rb:531:in `render_partial'

/var/www/wagn/app/helpers/slot.rb:235:in `render'

/var/www/wagn/app/helpers/slot.rb:571:in `process_inclusion'

/var/www/wagn/app/helpers/slot.rb:468:in `expand_inclusion'

/var/www/wagn/app/helpers/slot.rb:430:in `expand_inclusions'

/var/www/wagn/app/helpers/slot.rb:429:in `gsub'

/var/www/wagn/app/helpers/slot.rb:429:in `expand_inclusions'

/var/www/wagn/app/helpers/slot.rb:343:in `render_expanded_view_content'

/var/www/wagn/app/helpers/slot.rb:281:in `render'

/var/www/wagn/app/helpers/wagn_helper.rb:296:in `render_layout_card'

/var/www/wagn/app/views/layouts/application.html.erb:32:in `_run_erb_app47views47layouts47application46html46erb'

/var/www/wagn/app/controllers/card_controller.rb:62:in `render_show'

/var/www/wagn/app/controllers/card_controller.rb:56:in `show'

Request

 

Parameters:

 

{"id"=>"Home"}

Show session dump

 

Response

 

Headers:

 

{"Content-Type"=>"text/html",

 "Cache-Control"=>"no-cache"}

 

 

 

I wondered if there was not some issue with the version of WAGN I had so I upgraded to the latest version using method #1 described at http://www.wagn.org/wagn/Upgrading.

 

I now get the nil.unpack error when I get to step 4 and try to run 'rake db:migrate':

 

 

# rake db:migrate --trace

(in /var/www/wagn)

** Invoke db:migrate (first_time)

** Invoke environment (first_time)

** Invoke setup (first_time)

** Execute setup

** Execute environment

** Execute db:migrate

==  PatternizeHelpText: migrating =============================================

rake aborted!

An error has occurred, all later migrations canceled:

 

You have a nil object when you didn't expect it!

The error occurred while evaluating nil.unpack

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:265:in `read_state'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:224:in `next_sequence'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:255:in `open_lock'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:252:in `open'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:223:in `next_sequence'

/var/www/wagn/vendor/gems/uuid-2.0.2/lib/uuid.rb:160:in `initialize'

/var/www/wagn/lib/cardlib/tracked_attributes.rb:41:in `new'

/var/www/wagn/lib/cardlib/tracked_attributes.rb:41:in `set_name'

/var/www/wagn/lib/cardlib/tracked_attributes.rb:7:in `send'

/var/www/wagn/lib/cardlib/tracked_attributes.rb:7:in `set_tracked_attributes'

/var/www/wagn/lib/cardlib/attribute_tracking.rb:28:in `each_pair'

/var/www/wagn/lib/cardlib/attribute_tracking.rb:28:in `each_pair'

/var/www/wagn/lib/cardlib/tracked_attributes.rb:6:in `set_tracked_attributes'

/var/www/wagn/lib/cardlib/tracked_attributes.rb:197

/var/www/wagn/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `call'

/var/www/wagn/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'

/var/www/wagn/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'

/var/www/wagn/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send'

/var/www/wagn/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'

/var/www/wagn/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:in `run_callbacks'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/callbacks.rb:344:in `callback'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/callbacks.rb:249:in `create_or_update'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/base.rb:2538:in `save_without_validation'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/validations.rb:1078:in `save_without_dirty'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/dirty.rb:79:in `save_without_transactions'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `send'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save_without_trash'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save_without_trash'

/var/www/wagn/app/models/card/base.rb:241:in `save_without_permissions'

/var/www/wagn/lib/cardlib/permissions.rb:54:in `save'

/var/www/wagn/app/models/card/base.rb:235:in `save_without_permissions!'

/var/www/wagn/lib/cardlib/permissions.rb:63:in `save!'

./db/migrate//20091207232807_patternize_help_text.rb:26:in `up_without_benchmarks'

./db/migrate//20091207232807_patternize_help_text.rb:18:in `each'

./db/migrate//20091207232807_patternize_help_text.rb:18:in `up_without_benchmarks'

./db/migrate//20091207232807_patternize_help_text.rb:4:in `each'

./db/migrate//20091207232807_patternize_help_text.rb:4:in `up_without_benchmarks'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `send'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'

/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `__send__'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `migrate'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:486

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `call'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `ddl_transaction'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:485:in `migrate'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `each'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `migrate'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:400:in `up'

/var/www/wagn/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'

/var/www/wagn/vendor/rails/railties/lib/tasks/databases.rake:116

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'

/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'

/var/lib/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'

/var/lib/gems/1.8/gems/rake-0.8.7/bin/rake:31

/usr/bin/rake:19:in `load'

/usr/bin/rake:19

 

 

The only changes I am aware of on the system is possibly gem updates.

 

Here are the installation details:

 

 

uname -a

Linux dev01 2.6.32-26-generic-pae #48-Ubuntu SMP Wed Nov 24 10:31:20 UTC 2010 i686 GNU/Linux

rails -v

Rails 2.3.8

ruby -v

ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]

gem list

 

*** LOCAL GEMS ***

 

actionmailer (2.3.8)

actionpack (2.3.8)

activemodel (3.0.1)

activerecord (3.0.1, 2.3.8)

activerecord-odbc-adapter (2.0)

activeresource (2.3.8)

activesupport (3.0.1, 2.3.8)

amatch (0.2.5)

arel (1.0.1)

builder (2.1.2)

bunny (0.6.0)

daemon_controller (0.2.5)

elif (0.1.0)

fastercsv (1.5.3)

fastthread (1.0.7)

file-tail (1.0.5)

hashery (1.3.0)

hoptoad_notifier (2.3.12)

htmlentities (4.2.2)

i18n (0.5.0, 0.4.2)

ibm-alarm-update (1.0.5)

ibm-cache-primer (2.0.1)

ibm-compliance-report (1.0.13)

ibm-effector (3.0.0)

ibm-libcrypto (1.0.0)

ibm-livehealth-ack (1.0.0)

ibm-ssh-interactive (1.0.3)

ibm-systems-tools (1.0.1)

ibm-tac_plus-logagent (0.0.2)

ibm-telnet (0.0.5)

ibm-tools (1.0.1)

ipadmin (0.4.1)

json (1.4.6)

json_pure (1.4.6)

mailfactory (1.4.0)

memcached (1.0.2)

memoize (1.3.1)

mime-types (1.16)

msgpack (0.4.4)

mysql (2.8.1)

net-ssh (2.0.23)

open4 (1.0.1, 0.9.6)

passenger (2.2.15)

rack (1.1.0)

rails (2.3.8)

rake (0.8.7)

rake-remote_task (2.0.2)

redis (2.1.1)

ruby-odbc (0.99992)

snmp (1.0.3)

spruz (0.2.2)

sys-uptime (0.5.3 x86-linux)

system_timer (1.0)

tzinfo (0.3.23)

vlad (2.1.0)

vlad-git (2.2.0)

 

 

First off, thanks for all the contextual info.  Very helpful.

 

It seems pretty clear that the problem is with the uuid gem, though I'm not immediately certain I know how to fix it.  You don't have the gem installed locally; it's in /vendor/plugins.  I'd have to ask around to figure out how that got there; I don't think it's usually there for folks who do the git install, so it may be a legacy thing.

 

If I were working on this, the first thing I would try would be moving the gem out of /var/www/wagn/vendor/gems/ into some holding space and installing the gem locally.

 

In any case, Wagn only makes a very basic call to the uuid gem (UUID.new.generate), and it's failing, so it's pretty clear the problem is pretty localized.

 

Let us know if the above doesn't work.

 

-e

 


My vendor/gems/ (the uuid gem was not in vendor/plugins/) looks like this:

 

# ls -la vendor/gems/

total 28

drwxr-xr-x 7 www-data www-data 4096 2010-05-11 09:40 .

drwxr-xr-x 5 www-data www-data 4096 2010-05-11 09:40 ..

drwxr-xr-x 3 www-data www-data 4096 2010-05-11 09:40 assert2-0.5.5

drwxr-xr-x 10 www-data www-data 4096 2010-05-11 09:40 json-1.1.7

drwxr-xr-x 3 www-data www-data 4096 2010-05-11 09:40 macaddr-1.0.0

drwxr-xr-x 6 www-data www-data 4096 2010-05-11 09:40 ruby-openid-2.1.7

drwxr-xr-x 4 www-data www-data 4096 2009-09-10 08:32 uuid-2.0.2

 

I have moved both the macaddr (this is a dependancy of the uuid gem) and uuid gem elsewhere and installed them system-wide.

 

This has fixed my issue.

  --Charl Matthee (Not signed in).....Wed Dec 15 13:08:23 -0800 2010


Oh, great. Thanks for letting us know what you did. (yeah, I meant vendor/gems, not vendor/plugins)

  --Ethan McCutchen.....Wed Dec 15 16:09:52 -0800 2010