add-apt-repository crashed with ValueError in raw_decode(): No JSON object could be decoded

Bug #861258 reported by Michael Moroni
178
This bug affects 34 people
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Fix Released
Medium
Martin Pitt

Bug Description

I tried to insert a PPA but an error appeared. I tried later but all worked fine.

ProblemType: Crash
DistroRelease: Ubuntu 11.10
Package: python-software-properties 0.81.9
ProcVersionSignature: Ubuntu 3.0.0-12.19-generic 3.0.4
Uname: Linux 3.0.0-12-generic i686
ApportVersion: 1.23-0ubuntu1
Architecture: i386
Date: Wed Sep 28 10:16:56 2011
ExecutablePath: /usr/bin/add-apt-repository
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/add-apt-repository ppa:webkit-team/ppa
PythonArgs: ['/usr/bin/add-apt-repository', 'ppa:webkit-team/ppa']
SourcePackage: software-properties
Title: add-apt-repository crashed with ValueError in raw_decode(): No JSON object could be decoded
UpgradeStatus: Upgraded to oneiric on 2011-09-26 (1 days ago)
UserGroups:

Revision history for this message
Michael Moroni (airon90) wrote :
tags: removed: need-duplicate-check
visibility: private → public
Revision history for this message
Robert Roth (evfool) wrote :

Can you still reproduce this? Based on the description and the traceback it should've been caused by some temporary server issue. That could be treated better indeed, but there's no easy way to test it.

Changed in software-properties (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for software-properties (Ubuntu) because there has been no activity for 60 days.]

Changed in software-properties (Ubuntu):
status: Incomplete → Expired
Changed in software-properties (Ubuntu):
status: Expired → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in software-properties (Ubuntu):
status: New → Confirmed
Revision history for this message
Robert Roth (evfool) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please answer these questions:

* Is this reproducible?
* If so, what specific steps should we take to recreate this bug?

This will help us to find and resolve the problem.
---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Changed in software-properties (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Michael Moroni (airon90) wrote :

I don't remember because this bug is old.
I think it's better to close it :)

Revision history for this message
Ernst Persson (ernstp) wrote :

I got this error when trying to add ppa:ubuntu-desktop/ppa a few minutes ago.

Revision history for this message
Robert Roth (evfool) wrote :

I have just tried adding the ppa:ubuntu-desktop/ppa on Oneiric, and it worked.
---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Revision history for this message
Sean Seago (speedkreature) wrote :

Testing 12.04 Desktop 64-bit. Added ppa:unity-team/hud and later added ppa:unity-team/ppa. Updated. Did apt-get -y dist-upgrade. Rebooted. Upon login, got a popup informing me that apt-add-repository had crashed.

Revision history for this message
bilal el moussaoui (bil-elmoussaoui) wrote :

i have the same problem , in my ubuntu 12.04

Revision history for this message
Robert Roth (evfool) wrote :

Setting back to Confirmed, please let me know if someone knows a 100% sure method of reproducing it, and describe the steps, as I can not reproduce it.
---
Ubuntu Bug Squad volunteer triager
http://wiki.ubuntu.com/BugSquad

Changed in software-properties (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Lorenzo Mattei (lore-mattei) wrote :

I'm testing 12.04 32-bit and have this problem trying to add ppa:/scope-packagers/ppa

Revision history for this message
Sascha (skbierm-deactivatedaccount) wrote :

I'm using 12.04 and the bug occured also for me.

To reproduce:
sudo add-apt-repository ppa://dallen.wilson/ultima

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 125, in <module>
    ppa_info = get_ppa_info_from_lp(user, ppa_name)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 83, in get_ppa_info_from_lp
    return json.loads(lp_page)
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

tags: added: precise
Revision history for this message
Brian Murray (brian-murray) wrote :

Another way to recreate the same Traceback reliably is to use a nonexistent lp user and ppa. For example:

In [6]: ppa.get_ppa_info_from_lp('curiousgeorge', 'forthemanwiththeyellowhat')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/scratch/<ipython-input-6-01397e6b7db0> in <module>()
----> 1 ppa.get_ppa_info_from_lp('curiousgeorge', 'forthemanwiththeyellowhat')

/usr/lib/python2.7/dist-packages/softwareproperties/ppa.pyc in get_ppa_info_from_lp(owner_name, ppa_name)
     81 curl.close()
     82 lp_page = callback.contents
---> 83 return json.loads(lp_page)
     84
     85 class AddPPASigningKeyThread(Thread):

/usr/lib/python2.7/json/__init__.pyc in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    324 parse_int is None and parse_float is None and
    325 parse_constant is None and object_pairs_hook is None and not kw):
--> 326 return _default_decoder.decode(s)
    327 if cls is None:
    328 cls = JSONDecoder

/usr/lib/python2.7/json/decoder.pyc in decode(self, s, _w)
    364
    365 """
--> 366 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    367 end = _w(s, end).end()
    368 if end != len(s):

/usr/lib/python2.7/json/decoder.pyc in raw_decode(self, s, idx)
    382 obj, end = self.scan_once(s, idx)
    383 except StopIteration:
--> 384 raise ValueError("No JSON object could be decoded")
    385 return obj, end

ValueError: No JSON object could be decoded

Changed in software-properties (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Martin Pitt (pitti)
Changed in software-properties (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.82.5

---------------
software-properties (0.82.5) precise; urgency=low

  * softwareproperties/gtk/SoftwarePropertiesGtk.py: Drop duplicate definition
    of on_treeview_sources_cursor_changed().
  * softwareproperties/gtk/SoftwarePropertiesGtk.py: Fix crash when closing
    the application with the window title bar button. (LP: #911834)
  * add-apt-repository: Intercept ValueError in addition to URLError, as this
    is the error thrown when trying to decode invalid JSON (which happens on
    404 pages etc.). (LP: #861258)
  * softwareproperties/SoftwareProperties.py, _find_source_from_string():
    Reload the sources list before searching, as it might have changed while
    the D-BUS backend was running. (LP: #854818, #820150)
  * softwareproperties/gtk/SoftwarePropertiesGtk.py: Add missing argument to
    menu popup() call. (LP: #815236)
 -- Martin Pitt <email address hidden> Wed, 07 Mar 2012 10:14:52 +0100

Changed in software-properties (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Sasa Paporovic (melchiaros) wrote :

Sorry, but I have tha same problem, instead this is marked as Fix Released.

I have tried:

user@ubuntu:~$ sudo add-apt-repository ppa:~kernel-ppa/mainline/v3.3-precise/
[sudo] password for user:
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 88, in <module>
    ppa_info = get_ppa_info_from_lp(user, ppa_name)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 83, in get_ppa_info_from_lp
    return json.loads(lp_page)
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
user@ubuntu:~$
----------------------------------------------------------------------------------------------------------------------------------

the ppa is properly wrong, but this should bot throw an error.

I am on Ubuntu11.10 64bit with software-properties-common 0.81.13.3

Revision history for this message
Vadim Rutkovsky (roignac) wrote : Re: [Bug 861258] Re: add-apt-repository crashed with ValueError in raw_decode(): No JSON object could be decoded

melchiaros, are you sure you have 0.82.5 version? Could you please
post the output of 'apt-cache policy software-properties'?

Revision history for this message
Sasa Paporovic (melchiaros) wrote :

Oh,
correct.

0.81.13.3software-properties-common.

How to handle this? Should I really opening a new report?

Revision history for this message
Vadim Rutkovsky (roignac) wrote :

No, this bug is fixed in Precise, so you should either upgrade to
Precise or request a backport (see
https://wiki.ubuntu.com/UbuntuBackports)

Revision history for this message
hexes (ivan-s-borisov) wrote :

sudo add-apt-repository ppa:tim-klingt/opencinematools
You are about to add the following PPA to your system:

 More info: https://launchpad.net/~tim-klingt/+archive/opencinematools
Press [ENTER] to continue or ctrl-c to cancel adding it

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 95, in run
    self.add_ppa_signing_key(self.ppa_path)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 105, in add_ppa_signing_key
    ppa_info = get_ppa_info_from_lp(owner_name, ppa_name)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 83, in get_ppa_info_from_lp
    return json.loads(lp_page)
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

Revision history for this message
hexes (ivan-s-borisov) wrote :

Sorry:
12.04
Linux hexes-pc 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

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

Remote bug watches

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