I have set up drupal 6. Created few content types and nodes for the same. Strange issue happens for one of my content type. It shows below message.

Page not found
The requested page could not be found.

I checked that node exists in the database. Not getting why this happens.

Thx,

Comments

choster’s picture

In the node table, are the uid and type associated with the "missing" node valid?

I encountered this problem recently. The users table was missing a row, and any nodes created by that uid turned up as page not found errors even though the row existed in the node table and all CCK fields were populated. Elsewhere, it has been reported that database restores sometimes cause the row for user 0 (i.e. the anonymous user) to be deleted, producing 404s and other unexpected behaviors.

choster’s picture

Title: Page not found » Page not found, but node exists
suffering drupal’s picture

Hi, I have a similar problems after moving our site to a new server.
We set up the whole site again step by step and imported all the dates from a backup. So far so good. The backup was an "old" one from before certain problems (say from june) on the old server. But there was some new stuff we had been adding in july, still at the old server.

So now we just copied those new dates manually from the database at the old server to the new database. Copying ok, structure is the same and all the needed tables have the new dates now exactly as on the old server (we can still access the web too for comparison), this includes the following tables:
- node
- node revision
- node access
- content type gallery assist
- content type location
- location
- some domain tables
- some gallery assist tables
and some more stuff

Nothing of the new stuff appears on the website. Not even going to (new)node/####, admin/content/node or going to "node locations" at map/node, as if the database forgets/isn't able to tell Drupal there are some new nodes....
I could imagine some possible problems with specific modules since we are using a lot. But I understand that at least the basic node should be detected and found (and then possibly give an error) but not the "not found" result.

Comparing "old" nodes with the new ones I don't see any difference, but the impression I get is like some trigger hasn't been pulled so Drupal "sees" those new nodes in the database.

And I did clean all caches!
Any ideas?

arpieb’s picture

Version: 6.14 » 6.19

I just ran into the same thing on D6.19, and when I compared data I found that the UID for all the nodes in question had been set to 0, but there was no user 0 in the D6 user table. I wound up executing a SQL update on the nodes table, setting all uid's to a current admin-level user's uid where it was currently 0, and all my pages are now accessible.

Maybe some update SQL somewhere is causing grief? I recently updated to D6.19, and was having no problems until I removed the Views 3.x module and reverted back to Views 2.11 - which is nothing like what you guys are doing, but I had the same problem after the fact... Maybe something is freaking out intermittently and resetting UIDs on node records to 0 during database updates...?

unclejustin’s picture

FYI I just had this same problem after importing records manually (via SQL inserts). My problem was that I forgot to also populate the node_revisions table. As soon as I inserted matching records into node_revisions, everything was fine. Hope that helps.

drooopalstars’s picture

I faced the same issue.
And it was wrong uid problem. The uid associated with that nodeid in node table did not exist in users table
Just updating the uid worked for me.

Thanks choster!

geetotes’s picture

I was having this same problem of page not found on nodes. And man, was it frusturating. Here's a quickie SQL query to fix it.

UPDATE node SET uid = 3 (or whatever is the UID of a currently existing user)

This query will overwrite all the uids of every entry in the nodes table, so if you care about what user posted the content, don't use it. (Luckily in my case, I do not).

verta’s picture

Had this problem, and came to find that user 0 was no longer in the users table.

Installed a module, http://drupal.org/project/anonymous_user to fix it, since I do not have access to the db to run SQL on it.

Still not sure how user 0 got deleted, though.

mysterlune’s picture

Ran into this issue today, and took note of what was happening to the {users} table when migrating to the new database. The "0" user (anonymous) had been auto-incremented to the next available `uid` value -- in my case, 447.

According to the MySQL Developer site, reloading a mysqldumped table causes a row with a zero primary key value to auto increment unless the SQL mode is set beforehand to prevent this happening:

http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_no_a...

For me, just setting the 447 user's uid to 0 was sufficient to overcome the "Page not found" problem today. However, I thought this information could help for those of us migrating sites across servers.

verta’s picture

That (#9) sounds completely logical, but not sure it's not how I got into this state. I'm pretty sure my deployed db was made by dropping a copy of the MySQL folder.

But it's really no fun for this to happen. This is at least a normal level bug, if not a critical one.

If it's unacceptable and this problematic to the Drupal application for user zero (UID 0) to not exist, it needs to detect and protect against the case.

I installed
http://drupal.org/project/anonymous_user
and thought it might be evaluated for purposes of this discussion.

Here's all it does:
.install



/**
 * Creates anonymous user with id=0
 */
function anonymous_user_create($delete = false) {
	db_query("DELETE FROM {users} WHERE uid = 0");
	if (!$delete) {
		db_query("INSERT INTO {users} (name) VALUES ('')");
		db_query("UPDATE {users} SET uid = 0 WHERE name='' LIMIT 1");
	}
}

function anonymous_user_install() {
	anonymous_user_create();
}

function anonymous_user_uninstall() {
	anonymous_user_create(true);
}

and the .module


function anonymous_user_cron() {
	module_load_install('anonymous_user');
	anonymous_user_create();
}

I really don't know enough about this to evaluate it.

noomz’s picture

Priority: Minor » Normal

Subscribe.

Fr0s7’s picture

Yep, this was the cluprit with me as well. Almost all nodes were created by user 1, but the ones showing a 404 were created by user 0. In phpMyAdmin I simply browsed the 'node' table, sorted by 'uid', selected all of the nodes created by user 0, and edited them to uid 1. This fixed the 404 issue.

The root cause of this for me was previously editing the 'user' table in phpMyAdmin, exporting the database, and re-importing it at another location. I believe it was the incrementing problem described elsewhere in this post.

verta’s picture

Title: Page not found, but node exists » nodes created by user 0 cannot be found because user 0 does not exist

Updating the title.

Although I am now thinking of suggesting that this be moved to the database system component and retitled 'Detect missing user 0 and create if missing.' Perhaps this could be something that runs on the status page, rather than during normal site processing.

verta’s picture

Title: nodes created by user 0 cannot be found because user 0 does not exist » nodes created by user 0 cannot be found if user 0 does not exist

typo, I meant "if" ...

toby53’s picture

Thank you so much !
I changed my uid 0 to uid 1 (a current user) and the nodes became accessible !

dpearcefl’s picture

toby53, please change the status to closed if your issue if resolved.

verta’s picture

Just a comment from the gallery, I don't consider it closed if this situation can exist and have Drupal not care and appear to lose content. It may be a workaround to hack your database if your site comes to this this unfortunate state, but it's not really a resolved issue.

Perhaps we could move this to the status report page (admin status) as something to validate and offer assistance with when things are not right?

dpearcefl’s picture

I'm not sure that having user 0 (anonymous) creating nodes is a realistic use case. And having a uid of '0' in the users table is certainly required in D6 or really funky things start to happen..

dddave’s picture

Category: bug » support
Status: Active » Fixed

I just overflew the issue but it seems that the problem boils down to a missing uid 0. That happens mostly after transfering databases and is not a Drupal specific problem.

"Missing" nodes are merely a symptom in this case and the cure is clear: Recreate UID 0.

re#18 anonymous content creation is not that uncommon. The rest of your statement is true though.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.