bzr: ERROR: not well-formed (invalid token)

Bug #257895 reported by Sam Williams
28
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Incomplete
Undecided
Unassigned
bzr (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

I started getting this error a couple of days ago with bzr. I have tried everything to fix it, but it is still broken. Currently, I was using bzr in a centralized repository fashion, with the repository at home and I was accessing from work.

I am now using both server and client with the following characteristics, although in the beginning I was receiving the error with the version 1.3.1 that is current in the Hardy repositories.

  Bazaar (bzr) 1.6rc2
  Python interpreter: /usr/bin/python 2.5.2
  Python standard library: /usr/lib/python2.5
  bzrlib: /usr/lib/python2.5/site-packages/bzrlib
  Bazaar configuration: /home/sam/.bazaar
  Bazaar log file: /home/sam/.bzr.log

Essentially when I run any operation that requires getting a file listing from the repository I receive the following error:

~/Scripts> bzr update
bzr: ERROR: not well-formed (invalid token): line 136, column 59

Looking at the error I decided to drive down a little more with the "-Derror" option. When I did I received the following error.

stdin: is not a tty
bzr: ERROR: bzrlib.errors.UnexpectedInventoryFormat: not well-formed (invalid token): line 136, column 59

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 857, in run_bzr_catch_errors
    return run_bzr(argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 797, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.5/site-packages/bzrlib/commands.py", line 499, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.5/site-packages/bzrlib/builtins.py", line 1026, in run
    possible_transports=possible_transports)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 2127, in update
    return self._update_tree(old_tip, change_reporter)
  File "/usr/lib/python2.5/site-packages/bzrlib/mutabletree.py", line 52, in tree_write_locked
    return unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/workingtree.py", line 2158, in _update_tree
    to_tree = self.branch.basis_tree()
  File "/usr/lib/python2.5/site-packages/bzrlib/branch.py", line 1707, in basis_tree
    return self.repository.revision_tree(self.last_revision())
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 138, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1663, in revision_tree
    inv = self.get_revision_inventory(revision_id)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 138, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1627, in get_revision_inventory
    return self.get_inventory(revision_id)
  File "/usr/lib/python2.5/site-packages/bzrlib/decorators.py", line 138, in read_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1520, in get_inventory
    return self.iter_inventories([revision_id]).next()
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1539, in _iter_inventories
    yield self.deserialise_inventory(revision_id, text)
  File "/usr/lib/python2.5/site-packages/bzrlib/repository.py", line 1559, in deserialise_inventory
    result = self._serializer.read_inventory_from_string(xml, revision_id)
  File "/usr/lib/python2.5/site-packages/bzrlib/xml_serializer.py", line 77, in read_inventory_from_string
    raise errors.UnexpectedInventoryFormat(e)
UnexpectedInventoryFormat: not well-formed (invalid token): line 136, column 59

Any advice on how to repair this problem short of completely recreating the repository would be greatly appreciated.

Good Luck

Tags: knits
Revision history for this message
Sascha Peilicke (saschpe) wrote :

Confirmed, I have the same error here.

Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Are there perhaps any files in the repository that contain newlines in their name?

Revision history for this message
Robert Collins (lifeless) wrote :

This looks like invalid XML in the repository. Are you using bzr-svn or some other foreign format. Also can you run 'bzr check' please.

Changed in bzr:
status: New → Incomplete
Revision history for this message
John Seifarth (john-waw) wrote :

I have a similar problem. I'm running Ubuntu 9.04. I had the problem with the version included in Jaunty, as well as the more up-to-date package from http://ppa.launchpad.net/bzr/ppa/ubuntu

I thought that I had a corrupt archive, since I pulled it in off a failing drive.

bzr status works, as does bzr log. However bzr check gives me:

bzr check
Checking working tree at 'file:///home/web/work/veridic/'.
bzr: ERROR: not well-formed (invalid token): line 12, column 58

Trying to commit my current changes
bzr commit -F commit_message.txt
Committing to: /home/web/work/veridic/
aborting commit write group: UnexpectedInventoryFormat(not well-formed (invalid token): line 12, column 58)
bzr: ERROR: not well-formed (invalid token): line 12, column 58

I'm not at all familiar with python, can anyone give me pointers where to look further?

Revision history for this message
Martin Pool (mbp) wrote :

This might indicate drive-level corruption.

Probably a good thing to do next would be to get the traceback from ~/.bzr.log and also the output of 'bzr info' in that directory.

Revision history for this message
John Seifarth (john-waw) wrote :
Download full text (4.1 KiB)

Here's a ~/.bzr.log excerpt for commit:

Fri 2009-06-26 01:20:18 +0200
0.012 bzr arguments: [u'commit', u'-F', u'commit_message.txt']
0.021 looking for plugins in /home/users/john/.bazaar/plugins
0.021 looking for plugins in /usr/lib/python2.6/dist-packages/bzrlib/plugins
0.063 encoding stdout as sys.stdout encoding 'UTF-8'
0.085 opening working tree '/home/web/work/veridic'
0.108 preparing to commit
[22075] 2009-06-26 01:20:19.065 INFO: Committing to: /home/web/work/veridic/
0.125 Selecting files for commit with filter []
0.147 aborting commit write group because of exception:
0.148 Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 363, in commit
    self._update_builder_with_changes()
  File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 644, in _update_builder_with_changes
    self.work_tree, self.basis_revid, iter_changes):
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 585, in record_iter_changes
    revtrees = list(self.repository.revision_trees(self.parents))
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 2323, in revision_trees
    for inv in inventories:
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 2184, in _iter_inventories
    yield self.deserialise_inventory(revision_id, text)
  File "/usr/lib/python2.6/dist-packages/bzrlib/repository.py", line 2206, in deserialise_inventory
    entry_cache=self._inventory_entry_cache)
  File "/usr/lib/python2.6/dist-packages/bzrlib/xml_serializer.py", line 75, in read_inventory_from_string
    raise errors.UnexpectedInventoryFormat(e)
UnexpectedInventoryFormat: not well-formed (invalid token): line 12, column 58
[22075] 2009-06-26 01:20:19.091 INFO: aborting commit write group: UnexpectedInventoryFormat(not well-formed (invalid token): line 12, column 58)
0.164 Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 729, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 924, in run_bzr
    ret = run(*run_argv)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commands.py", line 560, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/usr/lib/python2.6/dist-packages/bzrlib/builtins.py", line 2937, in run
    exclude=safe_relpath_files(tree, exclude))
  File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/workingtree_4.py", line 226, in commit
    result = WorkingTree3.commit(self, message, revprops, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/decorators.py", line 192, in write_locked
    result = unbound(self, *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/mutabletree.py", line 228, in commit
    *args, **kwargs)
  File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 363, in commit
    self._update_builder_with_changes()
  File "/usr/lib/python2.6/dist-packages/bzrlib/commit.py", line 644, in _update_builder_with_changes
    self.work_tree, self.ba...

Read more...

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 257895] Re: bzr: ERROR: not well-formed (invalid token)

It looks like a good next step would be to look at the extracted
inventory and see whether the problem looks like on-disk corruption or
something that might have originated in bzr....

Robert is working on a tool that can pull data back from
partly-readable repositories.

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
Martin Pool (mbp) wrote :

To get the inventory you should be able to do this:

in your shell, export BZR_PDB=1
run the command that fails
when it errors, you should get a debugger prompt
in it, type "pp xml_string"
and "pp locals()"

and paste the output into this bug, either directly if it's short or
as an attachment if it's long

if the filenames in your tree are confidential, you can change the bug
to be private first.

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
Eric Siegerman (eric97) wrote :

FWIW (which might not be much, this close to blessing 2a as the default format)...

Attached is a simple reproduction of what I think is the same problem, using bzr.dev r4596 (which is approximately 1.18rc1, not sure exactly). I'll summarize here. (The attachment contains the requested xml_string and locals() output from the debugger, along with a stack trace.)

To reproduce, create a branch (either standalone or shared-repo is fine), add file called "a^Gb" (literal CTRL-G character), and commit.

pack-0.92 and 1.14 demonstrate the problem; 2a does *not*; I haven't tried other formats.

Once you've got a branch in this state, "check" fails. "log" succeeds, but "log -v" fails.

Importantly, "upgrade --2a" also fails. Thus, the fact that 2a itself doesn't suffer from the problem is little consolation to people with older branches that do suffer from it.

Here's a clue to a possible fix: "co" fails, but if you remove the file from your working tree (assuming, of course, that you haven't already "remove-tree"ed the latter), "revert" *succeeds* in restoring it. So there appears to be at least one code path that avoids the bug.

Bugs 267670, 346471, and 407303 look superficially like duplicates of this, but I'm not confident enough of that to mark them as such.

Jelmer Vernooij (jelmer)
tags: added: knits
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.